IO bandwidth control method, IO access request processing method, apparatus, and system

ABSTRACT

An input output (IO) bandwidth control method, an IO access request processing method, an apparatus, and a system relate to the field of storage technologies, where the IO bandwidth control method, executed by a name node, includes determining an IO bandwidth of each data node in at least one data node and an IO bandwidth of a first tenant, and instructing the at least one data node to allocate the at least one IO bandwidth to the first tenant based on the IO bandwidth of each data node and the IO bandwidth of the first tenant, where the at least one IO bandwidth is in a one-to-one correspondence with the at least one data node, and each IO bandwidth in the at least one IO bandwidth is greater than 0 and is less than or equal to an IO bandwidth of a corresponding data node.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of International Patent ApplicationNo. PCT/CN2016/089836 filed on Jul. 12, 2016, which is herebyincorporated by reference in its entirety.

TECHNICAL FIELD

The present application relates to the field of storage technologies,and in particular, to an input output (IO) bandwidth control method, anIO access request processing method, an apparatus, and a system.

BACKGROUND

With continuous development of storage technologies, a distributed filesystem is increasingly widely used. As shown in FIG. 1, FIG. 1 is aschematic diagram in which an application accesses a distributed filesystem.

Generally, when an application such as an application 1 accesses thedistributed file system, the distributed file system may allocate an IObandwidth 1 to the application 1 according to an IO access request 1 ofthe application 1. When another application such as an application 2accesses the distributed file system, the distributed file system mayreallocate a new IO bandwidth 2 to the application 2 according to an IOaccess request 2 of the application 2. The IO bandwidth 2 is differentfrom the IO bandwidth 1.

In the foregoing technical solution, because the distributed file systemneeds to allocate different IO bandwidths to different applications, amanner of allocating an IO bandwidth is not flexible.

SUMMARY

This application provides an IO bandwidth control method, an IO accessrequest processing method, an apparatus, and a system such that a mannerof allocating an IO bandwidth is relatively flexible.

To achieve the foregoing objective, this application uses the followingtechnical solutions.

According to a first aspect, an IO bandwidth control method applied to adistributed file system is provided. The distributed file systemincludes a name node and a at least one data node.

The method includes determining, by the name node, an IO bandwidth ofeach data node in the at least one data node and an IO bandwidth of afirst tenant, and instructing, based on the IO bandwidth of each datanode in the at least one data node and the IO bandwidth of the firsttenant, the at least one data node to allocate at least one IO bandwidthto the first tenant.

The at least one IO bandwidth is in a one-to-one correspondence with theat least one data node, and each IO bandwidth in the at least one IObandwidth is greater than 0 and is less than or equal to an IO bandwidthof a corresponding data node.

According to the foregoing method, an IO bandwidth can be allocated to atenant in this application such that a manner of allocating an IObandwidth is relatively flexible.

The IO bandwidth of the tenant is shared by at least one user, and eachuser in the at least one user corresponds to at least one application.Therefore, multiple applications corresponding to the at least one userthat belongs to the tenant may share the IO bandwidth allocated to thetenant. Even if the multiple applications may be different at differentmoments, the multiple applications still share the IO bandwidthallocated to the tenant such that utilization of an IO bandwidth in thedistributed file system can be improved.

In a first optional implementation manner of the first aspect, a sum ofthe at least one IO bandwidth is less than or equal to the IO bandwidthof the first tenant, or a sum of the at least one IO bandwidth is lessthan or equal to a sum of the IO bandwidth of the first tenant and anextra bandwidth.

According to the first optional implementation manner of the firstaspect, the name node may instruct a data node to allocate a proper IObandwidth to the first tenant. For example, the name node may instruct adata node to allocate an IO bandwidth to the first tenant according to apriority of the first tenant in order to satisfy an IO bandwidthrequirement of the first tenant as much as possible.

In a second optional implementation manner of the first aspect, the atleast one data node includes a first data node, an IO bandwidthallocated by the first data node to the first tenant according to aninstruction of the name node is a first IO bandwidth, and the first IObandwidth is an IO bandwidth that is in the at least one IO bandwidthand corresponding to the first data node.

After instructing, by the name node based on the IO bandwidth of eachdata node in the at least one data node and the IO bandwidth of thefirst tenant, the at least one data node to allocate at least one IObandwidth to the first tenant, the method further includes determining,by the name node, that an IO bandwidth that is in the at least one IObandwidth and that is used by the first tenant is at least one utilizedbandwidth, where the at least one utilized bandwidth is in a one-to-onecorrespondence with the at least one IO bandwidth, and instructing, bythe name node, the at least one data node to adjust a corresponding IObandwidth in the at least one IO bandwidth, or instructing the firstdata node to adjust the first IO bandwidth, according to the at leastone utilized bandwidth.

After the name node allocates the at least one IO bandwidth to the firsttenant, the first tenant may not use all the at least one IO bandwidth,or the at least one IO bandwidth may not satisfy the IO bandwidthrequired by the first tenant, or there is a big difference of using theat least one IO bandwidth by the first tenant (for example, a part ofthe at least one IO bandwidth is entirely used by the first tenant, butthe other part of the at least one IO bandwidth is rarely used by thefirst tenant). Therefore, the name node needs to instruct, according tothe at least one utilized bandwidth that is in the at least one IObandwidth and that is used by the first tenant, a corresponding datanode (which may be one or more data nodes included in the at least onedata node) to adjust the IO bandwidth allocated to the first tenant suchthat the name node can properly allocate an IO bandwidth to the firsttenant.

In a third optional implementation manner of the first aspect, afterinstructing, by the name node based on the IO bandwidth of each datanode in the at least one data node and the IO bandwidth of the firsttenant, the at least one data node to allocate at least one IO bandwidthto the first tenant, the method further includes determining, by thename node, that an IO bandwidth that is in the at least one IO bandwidthand that is used by the first tenant is at least one utilized bandwidth,where the at least one utilized bandwidth is in a one-to-onecorrespondence with the at least one IO bandwidth, and instructing, bythe name node, a second data node to allocate an IO bandwidth to thefirst tenant when a difference between the sum of the at least one IObandwidth and a sum of the at least one utilized bandwidth is less thanor equal to a first threshold, where the at least one data node does notinclude the second data node.

When the name node determines that the difference between the sum of theat least one IO bandwidth and the sum of the at least one utilizedbandwidth that is in the at least one IO bandwidth and that is used bythe first tenant is less than or equal to the first threshold, itindicates that an IO bandwidth actually used by the first tenant is veryclose to the IO bandwidth allocated by the at least one data node to thefirst tenant (i.e., the first tenant almost uses all the IO bandwidthallocated by the at least one data node to the first tenant). In thiscase, in order to preferentially ensure a service of the first tenantand enable the first tenant to have sufficient IO bandwidths, the namenode may further instruct another data node (such as the second datanode) other than the at least one data node in the distributed storagesystem to allocate an IO bandwidth to the first tenant, that is, thename node instructs to increase the IO bandwidth allocated to the firsttenant.

In a fourth optional implementation manner of the first aspect, afterinstructing, by the name node based on the IO bandwidth of each datanode in the at least one data node and the IO bandwidth of the firsttenant, the at least one data node to allocate at least one IO bandwidthto the first tenant, the method further includes determining, by thename node, that an IO bandwidth that is in the at least one IO bandwidthand that is used by the first tenant is at least one utilized bandwidth,where the at least one utilized bandwidth is in a one-to-onecorrespondence with the at least one IO bandwidth, and instructing, bythe name node, a third data node in the at least one data node to adjustan IO bandwidth allocated by the third data node to the first tenant to0 when a difference between the sum of the at least one IO bandwidth anda sum of the at least one utilized bandwidth is greater than a firstthreshold.

When the name node determines that the difference between the sum of theat least one IO bandwidth and the sum of the at least one utilizedbandwidth that is in the at least one IO bandwidth and that is used bythe first tenant is greater than the first threshold, it indicates thatan IO bandwidth actually used by the first tenant is far less than theIO bandwidth allocated by the at least one data node to the first tenant(i.e., the first tenant may use only a part of the IO bandwidthallocated by the at least one data node to the first tenant). In thiscase, in order to save an IO bandwidth (or to provide an IO bandwidththat is not used by the first tenant for another tenant for use), thename node may further instruct the third data node in the at least onedata node to adjust the IO bandwidth allocated by the third data node tothe first tenant to 0, that is, the name node instructs to decrease theIO bandwidth allocated to the first tenant.

In a fifth optional implementation manner of the first aspect, the atleast one data node includes a first data node, an IO bandwidthallocated by the first data node to the first tenant according to aninstruction of the name node is a first IO bandwidth, and the first IObandwidth is an IO bandwidth that is in the at least one IO bandwidthand corresponding to the first data node.

After instructing, by the name node based on the IO bandwidth of eachdata node in the at least one data node and the IO bandwidth of thefirst tenant, the at least one data node to allocate at least one IObandwidth to the first tenant, the method further includes determining,by the name node, an IO bandwidth that is in the first IO bandwidth andthat is used by the first tenant, and instructing, according to the IObandwidth that is in the first IO bandwidth and that is used by thefirst tenant, the first data node to adjust the first IO bandwidth.

According to the fifth optional implementation manner of the firstaspect, the name node may instruct, in a unit of data node, acorresponding data node (for example, the first data node) to adjust,within the data node, an IO bandwidth allocated by the data node to thefirst tenant. In this way, the name node may instruct, according to anIO bandwidth actually used by the first tenant on each data node, acorresponding data node to provide a more proper IO bandwidth for thefirst tenant, and may satisfy an IO bandwidth requirement of the firsttenant as much as possible.

In a sixth optional implementation manner of the first aspect, m tenantsinclude the first tenant, and m is a positive integer.

A method for determining the IO bandwidth of the first tenant by thename node includes determining, by the name node, the IO bandwidth ofthe first tenant according to a weight of each tenant in the m tenantsand a sum of the IO bandwidth of each data node in the at least one datanode.

The name node may determine the IO bandwidth of the first tenant using aformula 1.

The formula 1 includes that the IO bandwidth of the first tenant=aweight of the first tenant/a sum of weights of all tenants to which theat least one data node allocates an IO bandwidth×the sum of the IObandwidth of each data node in the at least one data node.

When allocating an IO bandwidth to a tenant using the formula 1, becausethe name node performs allocation according to a weight of each tenant,the IO bandwidth allocated to each tenant may evenly satisfy an IObandwidth requirement of each tenant as much as possible.

According to a second aspect, another IO bandwidth control method isprovided. The method is applied to a distributed file system, thedistributed file system includes at least one data node, and the atleast one data node includes a first data node. The method includesdetermining, by the first data node, an IO bandwidth of each data nodein the at least one data node and an IO bandwidth of a first tenant, andallocating a first IO bandwidth to the first tenant according to the IObandwidth of each data node in the at least one data node and the IObandwidth of the first tenant. The first IO bandwidth is greater than 0and is less than or equal to an IO bandwidth of the first data node.

According to the technical solution provided in the foregoing method, anIO bandwidth can be allocated to a tenant in this application such thata manner of allocating an IO bandwidth is relatively flexible.

The IO bandwidth of the tenant is shared by at least one user, and eachuser in the at least one user corresponds to at least one application.Therefore, multiple applications corresponding to the at least one userthat belongs to the tenant may share the IO bandwidth allocated to thetenant. Even if the multiple applications may be different at differentmoments, the multiple applications still share the IO bandwidthallocated to the tenant such that utilization of an IO bandwidth in thedistributed file system can be improved.

In comparison with the IO bandwidth control method shown in the firstaspect, each data node may allocate an IO bandwidth to a tenant withoutan instruction of a name node in the IO bandwidth control method shownin the second aspect, thereby alleviating a burden of the name node,saving resources of the name node, and reducing overheads of the namenode.

Further, because each data node does not need to allocate an IObandwidth to a tenant according to an instruction of the name node, eachdata node may allocate an IO bandwidth to a tenant on the data node inreal time, thereby improving real-time quality of controlling an IObandwidth at a tenant level.

In a first optional implementation manner of the second aspect, thefirst IO bandwidth is less than or equal to the IO bandwidth of thefirst tenant, or the first IO bandwidth is less than or equal to a sumof the IO bandwidth of the first tenant and an extra bandwidth.

According to the first optional implementation manner of the secondaspect, the first data node may allocate a proper IO bandwidth to thefirst tenant. For example, the first data node allocates an IO bandwidthto the first tenant according to a priority of the first tenant in orderto satisfy an IO bandwidth requirement of the first tenant as much aspossible.

In a second optional implementation manner of the second aspect, afterallocating, by the first data node, a first IO bandwidth to the firsttenant, the method further includes determining, by the first data node,an IO bandwidth that is used by the first tenant on the at least onedata node is at least one utilized bandwidth, and adjusting, by thefirst data node, the first IO bandwidth according to the at least oneutilized bandwidth.

After the first data node allocates the first IO bandwidth to the firsttenant, the first tenant may not use all the first IO bandwidth, thefirst IO bandwidth may be less than the IO bandwidth required by thefirst tenant, or there is a big difference of using the first IObandwidth by the first tenant (for example, a part of the first IObandwidth is entirely used by the first tenant, but the other part ofthe first IO bandwidth is rarely used by the first tenant). Therefore,the first data node needs to adjust, according to an actual utilizedbandwidth (further, the at least one utilized bandwidth) of the firsttenant, the first IO bandwidth allocated by the first data node to thefirst tenant. In this way, the first data node can properly allocate anIO bandwidth to the first tenant.

In a third optional implementation manner of the second aspect, afterallocating, by the first data node, a first IO bandwidth to the firsttenant, the method further includes determining, by the first data node,an IO bandwidth that is in the first IO bandwidth and that is used bythe first tenant, and adjusting, by the first data node, the first IObandwidth according to the IO bandwidth that is in the first IObandwidth and that is used by the first tenant.

After the first data node allocates the first IO bandwidth to the firsttenant, the first data node may adjust the first IO bandwidth accordingto an IO bandwidth that is in the first IO bandwidth and that isactually used by the first tenant. In this way, the first data node canprovide a proper IO bandwidth for the first tenant, and may satisfy anIO bandwidth requirement of the first tenant as much as possible.

In a fourth optional implementation manner of the second aspect, amethod for determining the IO bandwidth of the first tenant by the firstdata node includes determining, by the first data node, the IO bandwidthof the first tenant according to a weight of each tenant in m tenantsand a sum of the IO bandwidth of each data node in the at least one datanode.

For specific description and technical effects of the fourth optionalimplementation manner of the second aspect, refer to related descriptionof the sixth optional implementation manner of the first aspect. Detailsare not described herein again.

According to a third aspect, an IO access request processing method isprovided. The method is applied to a distributed file system, thedistributed file system includes at least one data node, and the atleast one data node includes a first data node. The method includesreceiving, by the first data node, an IO access request for accessingthe distributed file system by a tenant, determining, according to theIO access request, the tenant corresponding to the IO access request,and determining, according to an IO bandwidth allocated by the firstdata node to the tenant, whether to delay responding to the IO accessrequest.

The IO access request processing method provided in this application isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesa first data node. In this method, the first data node receives an IOaccess request for accessing the distributed file system by a tenant,determines, according to the IO access request, the tenant correspondingto the IO access request, and then determines, according to an IObandwidth allocated by the first data node to the tenant, whether todelay responding to the IO access request. In this application, an IObandwidth can be allocated to a tenant on a data node, and then the datanode may determine, according to the IO bandwidth allocated to thetenant, whether to delay responding to an IO access requestcorresponding to the tenant (further, in this application, the IO accessrequest is certainly responded to, and the responding may be immediateresponding or delayed responding) such that a success rate of respondingto the IO access request can be increased.

In a first optional implementation manner of the third aspect, a methodfor determining, by the first data node according to the IO bandwidthallocated by the first data node to the tenant, whether to delayresponding to the IO access request includes determining, by the firstdata node, a difference between the IO bandwidth allocated by the firstdata node to the tenant and an IO bandwidth used by the tenant on thefirst data node, and responding to the IO access request whendetermining that the difference is greater than a third threshold.

When the first data node determines that the difference between the IObandwidth allocated by the first data node to the tenant and the IObandwidth used by the tenant on the first data node is greater than thethird threshold, it indicates that some idle IO bandwidths exist in theIO bandwidth allocated by the first data node to the tenant, that is,the first data node has sufficient IO bandwidths to respond to the IOaccess request for accessing the distributed file system by the tenant.In this case, the first data node may immediately respond to the IOaccess request.

In a second optional implementation manner of the third aspect, a methodfor determining, by the first data node according to the IO bandwidthallocated by the first data node to the tenant, whether to delayresponding to the IO access request includes determining, by the firstdata node, a difference between the IO bandwidth allocated by the firstdata node to the tenant and an IO bandwidth used by the tenant on thefirst data node, and delaying responding to the IO access request whenthe difference is less than or equal to a third threshold.

When the first data node determines that the difference between the IObandwidth allocated by the first data node to the tenant and the IObandwidth used by the tenant on the first data node is less than orequal to the third threshold, it indicates that few idle IO bandwidthsexist in the IO bandwidth allocated by the first data node to thetenant, that is, the first data node currently does not have sufficientIO bandwidths to respond to the IO access request for accessing thedistributed file system by the tenant. In this case, the first data nodemay delay responding to the IO access request.

In a third optional implementation manner of the third aspect, beforethe first data node allocates the IO bandwidth to the tenant, the methodfurther includes receiving, by the first data node, an instruction of aname node.

A method for allocating the IO bandwidth to the tenant by the first datanode includes allocating, by the first data node, the IO bandwidth tothe tenant according to the instruction of the name node.

Because the name node may instruct each data node to allocate an IObandwidth to the tenant, the IO bandwidth can be properly allocated tothe tenant.

In a fourth optional implementation manner of the third aspect, a methodfor determining, by the first data node according to the IO accessrequest, the tenant corresponding to the IO access request includesdetermining, by the first data node according to a tenant identifiercarried in the IO access request, the tenant corresponding to the IOaccess request.

In a fifth optional implementation manner of the third aspect, a fileattribute of a file that belongs to the tenant and that is managed bythe distributed file system includes a tenant identifier. Thedistributed file system manages the file that belongs to the tenant, andthe file attribute of the file includes the tenant identifier of thetenant. In a scenario, the distributed file system manages files ofdifferent tenants, and a tenant to which a file belongs may bedetermined according to a tenant identifier included in a file attributeof the file.

A method for determining, by the first data node according to the IOaccess request, the tenant corresponding to the IO access requestincludes obtaining, by the first data node according to a file specifiedin the IO access request, a file attribute of the file specified in theIO access request, and determining, according to the tenant identifierincluded in the obtained file attribute, the tenant corresponding to theIO access request.

According to the foregoing two methods, after receiving the IO accessrequest, the first data node may accurately determine the tenantcorresponding to the IO access request, and then determine, according tothe IO bandwidth allocated by the first data node to the tenant, whetherto delay responding to the IO access request.

In a sixth optional implementation manner of the third aspect, themethod further includes allocating, by the first data node, an IObandwidth to each user in at least one user according to the IObandwidth allocated by the first data node to the tenant and a weight ofeach user in the at least one user that uses the tenant.

The first data node allocates, using a formula 2 and based on the IObandwidth allocated by the first data node to the tenant, the IObandwidth to each user in the at least one user that uses the tenant.

The formula 2 includes that an IO bandwidth of a user=a weight of theuser/a sum of weights of all users who use the tenant×the IO bandwidthallocated by the first data node to the tenant.

When allocating, using the formula 2, an IO bandwidth to each user thatbelongs to the tenant, because the first data node performs allocationaccording to a weight of each user, the IO bandwidth allocated to eachuser may evenly satisfy an IO bandwidth requirement of each user as muchas possible.

In a seventh optional implementation manner of the third aspect, themethod further includes allocating, by the first data node, an IObandwidth to each client in at least one client according to a weight ofeach client in the at least one client and an IO bandwidth allocated bythe first data node to a first user that starts the at least one client.

The first data node allocates, using a formula 3 and based on the IObandwidth allocated by the first data node to the first user that startsthe at least one client, the IO bandwidth to each client in the at leastone client stated by the first user.

The formula 3 includes that an IO bandwidth of a client=a weight of theclient/a sum of weights of all clients started by the first user×the IObandwidth allocated by the first data node to the first user.

When allocating, using the formula 3, an IO bandwidth to each client towhich a user logs in, because the first data node performs allocationaccording to a weight of each client, the IO bandwidth allocated to eachclient may evenly satisfy an IO bandwidth requirement of each client asmuch as possible.

According to a fourth aspect, a name node is provided. The name node isapplied to a distributed file system, the distributed file systemincludes the name node and at least one data node, and the name nodeincludes a determining unit and an instruction unit.

The determining unit is configured to determine an IO bandwidth of eachdata node in the at least one data node and an IO bandwidth of a firsttenant. The instruction unit is configured to instruct, based on the IObandwidth of each data node in the at least one data node and the IObandwidth of the first tenant that are determined by the determiningunit, the at least one data node to allocate at least one IO bandwidthto the first tenant. The at least one IO bandwidth is in a one-to-onecorrespondence with the at least one data node, each IO bandwidth in theat least one IO bandwidth is less than or equal to an IO bandwidth of acorresponding data node, and each IO bandwidth in the at least one IObandwidth is greater than 0.

The name node provided in this application can allocate an IO bandwidthto a tenant such that a manner of allocating an IO bandwidth isrelatively flexible.

The IO bandwidth of the tenant is shared by at least one user, and eachuser in the at least one user corresponds to at least one application.Therefore, multiple applications corresponding to the at least one userthat belongs to the tenant may share the IO bandwidth allocated to thetenant. Even if the multiple applications may be different at differentmoments, the multiple applications still share the IO bandwidthallocated to the tenant such that utilization of an IO bandwidth in thedistributed file system can be improved.

It should be noted that the name node provided in this applicationincludes but is not limited to the determining unit and the instructionunit in the fourth aspect, and functions of the determining unit and theinstruction unit in the fourth aspect include but are not limited to theforegoing described functions. It should be noted that the name node mayinclude units and/or modules that are configured to perform the IObandwidth control method described in the first aspect and the optionalimplementation manners of the first aspect. That the name node includesthe determining unit and the instruction unit is merely an example, andthe units and/or the modules are obtained after logical division isperformed on the name node in order to perform the IO bandwidth controlmethod described in the first aspect and the optional implementationmanners of the first aspect.

For specific description of technical effects of various optionalimplementation manners of the fourth aspect, refer to relateddescription of technical effects of the corresponding optionalimplementation manners of the first aspect. Details are not describedherein again.

According to a fifth aspect, a data node is provided. The data node isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesthe data node. The data node includes a determining unit and anallocation unit.

The determining unit is configured to determine an IO bandwidth of eachdata node in the at least one data node and an IO bandwidth of a firsttenant. The allocation unit is configured to allocate a first IObandwidth to the first tenant according to the IO bandwidth of each datanode in the at least one data node and the IO bandwidth of the firsttenant that are determined by the determining unit. The first IObandwidth is less than or equal to an IO bandwidth of a first data node,and the first IO bandwidth is greater than 0.

The data node provided in this application may allocate the first IObandwidth to the first tenant such that a manner of allocating an IObandwidth is relatively flexible.

The first IO bandwidth of the first tenant is shared by at least oneuser. Each user in the at least one user corresponds to at least oneapplication. Therefore, multiple applications corresponding to the atleast one user that belongs to the first tenant may share the first IObandwidth allocated to the first tenant. Even if the multipleapplications may be different at different moments, the multipleapplications still share the first IO bandwidth allocated to the firsttenant such that utilization of an IO bandwidth of the data node can beimproved.

It should be noted that the data node provided in this applicationincludes but is not limited to the determining unit and the allocationunit in the fifth aspect, and functions that the determining unit andthe allocation unit in the fifth aspect have include but are not limitedto the foregoing described functions. It should be noted that the datanode may include units and/or modules that are configured to perform theIO bandwidth control method described in the second aspect and theoptional implementation manners of the second aspect. That the data nodeincludes the determining unit and the allocation unit is merely anexample, and the units and/or the modules are obtained after logicaldivision is performed on the data node in order to perform the IObandwidth control method described in the second aspect and the optionalimplementation manners of the second aspect.

For specific description of technical effects of various optionalimplementation manners of the fifth aspect, refer to related descriptionof technical effects of the corresponding optional implementationmanners of the second aspect. Details are not described herein again.

According to a sixth aspect, another data node is provided. The datanode is applied to a distributed file system, the distributed filesystem includes at least one data node, and the at least one data nodeincludes the data node. The data node includes a receiving unit, adetermining unit, and an allocation unit.

The receiving unit is configured to receive an IO access request foraccessing the distributed file system by a tenant. The determining unitis configured to determine, according to the IO access request receivedby the receiving unit, the tenant corresponding to the IO accessrequest, and determine, according to an IO bandwidth allocated by theallocation unit to the tenant, whether to delay responding to the IOaccess request.

The data node provided in this application is applied to a distributedfile system, the distributed file system includes at least one datanode, and the at least one data node includes the data node. The datanode receives an IO access request for accessing the distributed filesystem by a tenant, determines, according to the IO access request, thetenant corresponding to the IO access request, and then determines,according to an IO bandwidth allocated by the data node to the tenant,whether to delay responding to the IO access request. In thisapplication, an IO bandwidth can be allocated to a tenant on a datanode, and then the data node may determine, according to the IObandwidth allocated to the tenant, whether to delay responding to an IOaccess request corresponding to the tenant (further, in this embodimentof the present application, the IO access request is certainly respondedto, and the responding may be immediate responding or delayedresponding) such that a success rate of responding to the IO accessrequest can be increased.

It should be noted that the data node provided in this applicationincludes but is not limited to the receiving unit, the determining unit,and the allocation unit in the sixth aspect, and functions of thereceiving unit, the determining unit, and the allocation unit in thesixth aspect include but are not limited to the foregoing describedfunctions. It should be noted that the data node may include unitsand/or modules that are configured to perform the IO access requestprocessing method described in the third aspect and the optionalimplementation manners of the third aspect. That the data node includesthe receiving unit, the determining unit, and the allocation unit ismerely an example, and the units and/or the modules are obtained afterlogical division is performed on the data node in order to perform theIO access request processing method described in the third aspect andthe optional implementation manners of the third aspect.

For specific description of technical effects of various optionalimplementation manners of the sixth aspect, refer to related descriptionof technical effects of the corresponding optional implementationmanners of the third aspect. Details are not described herein again.

According to a seventh aspect, a name node is provided. The name node isapplied to a distributed file system, and the distributed file systemincludes the name node and at least one data node. The name nodeincludes at least one processor, an interface circuit, a memory, and asystem bus.

The memory is configured to store a computer execution instruction. Theat least one processor, the interface circuit, and the memory areinterconnected using the system bus. When the name node runs, the atleast one processor executes the computer execution instruction storedin the memory such that the name node performs the IO bandwidth controlmethod shown in the first aspect or the optional implementation mannersof the first aspect.

According to an eighth aspect, a computer readable storage medium isprovided. The computer readable storage medium stores a computerexecution instruction. When at least one processor of a name nodeexecutes the computer execution instruction, the name node performs theIO bandwidth control method shown in the first aspect or the optionalimplementation manners of the first aspect.

In addition, according to the eighth aspect, a computer program productis further provided. The computer program product includes a computerexecution instruction, and the computer execution instruction is storedin a computer readable storage medium. At least one processor of a namenode may read the computer execution instruction from the computerreadable storage medium, and when the name node executes the computerexecution instruction, the at least one processor performs the IObandwidth control method shown in the first aspect or the optionalimplementation manners of the first aspect.

For specific description of technical effects of the seventh aspect andthe eighth aspect, refer to related description of technical effects ofthe first aspect and the optional implementation manners of the firstaspect. Details are not described herein again.

According to a ninth aspect, a data node is provided. The data node isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesthe data node. The data node includes at least one processor, aninterface circuit, a memory, and a system bus.

The memory is configured to store a computer execution instruction. Theat least one processor, the interface circuit, and the memory areinterconnected using the system bus. When the data node runs, the atleast one processor executes the computer execution instruction storedin the memory such that the data node performs the IO bandwidth controlmethod shown in the second aspect or the optional implementation mannersof the second aspect.

According to a tenth aspect, a computer readable storage medium isprovided. The computer readable storage medium stores a computerexecution instruction. When at least one processor of a data nodeexecutes the computer execution instruction, the data node performs theIO bandwidth control method shown in the second aspect or the optionalimplementation manners of the second aspect.

In addition, according to the tenth aspect, a computer program productis further provided. The computer program product includes a computerexecution instruction, and the computer execution instruction is storedin a computer readable storage medium. At least one processor of a datanode may read the computer execution instruction from the computerreadable storage medium, and the at least one processor executes thecomputer execution instruction such that the data node performs the IObandwidth control method shown in the second aspect or the optionalimplementation manners of the second aspect.

For specific description of technical effects of the ninth aspect andthe tenth aspect, refer to related description of technical effects ofthe second aspect and the optional implementation manners of the secondaspect. Details are not described herein again.

According to an eleventh aspect, another data node is provided. The datanode is applied to a distributed file system, the distributed filesystem includes at least one data node, and the at least one data nodeincludes the data node. The data node includes at least one processor,an interface circuit, a memory, and a system bus.

The memory is configured to store a computer execution instruction. Theat least one processor, the interface circuit, and the memory areinterconnected using the system bus. When the data node runs, the atleast one processor executes the computer execution instruction storedin the memory such that the data node performs the IO access requestprocessing method shown in the third aspect or the optionalimplementation manners of the third aspect.

According to a twelfth aspect, a computer readable storage medium isprovided. The computer readable storage medium stores a computerexecution instruction. When at least one processor of a data nodeexecutes the computer execution instruction, the data node performs theIO access request processing method shown in the third aspect or theoptional implementation manners of the third aspect.

In addition, according to the twelfth aspect, a computer program productis further provided. The computer program product includes a computerexecution instruction, and the computer execution instruction is storedin a computer readable storage medium. At least one processor of a datanode may read the computer execution instruction from the computerreadable storage medium, and the at least one processor executes thecomputer execution instruction such that the data node performs the IOaccess request processing method shown in the third aspect or theoptional implementation manners of the third aspect.

For specific description of technical effects of the eleventh aspect andthe twelfth aspect, refer to related description of technical effects ofthe third aspect and the optional implementation manners of the thirdaspect. Details are not described herein again.

According to a thirteenth aspect, a distributed file system is provided.The distributed file system includes a name node and at least one datanode, and the name node is the name node described in the fourth aspector the seventh aspect.

Alternatively, the distributed file system includes at least one datanode, the at least one data node includes a first data node, and thefirst data node is the data node described in the fifth aspect or theninth aspect.

Alternatively, the distributed file system includes at least one datanode, the at least one data node includes a first data node, and thefirst data node is the data node described in the sixth aspect or theeleventh aspect.

For specific description of technical effects of the thirteenth aspect,refer to related description of technical effects of the fourth aspect,the seventh aspect, the fifth aspect, the ninth aspect, the sixthaspect, or the eleventh aspect. Details are not described herein again.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the presentapplication more clearly, the following briefly introduces theaccompanying drawings required for describing the embodiments. Theaccompanying drawings in the following description show merely someembodiments of the present application.

FIG. 1 is a schematic diagram of an architecture in which an applicationaccesses a distributed file system;

FIG. 2 is a schematic diagram of an architecture of a distributed filesystem according to an embodiment of the present application;

FIG. 3 is a schematic diagram of an architecture in which an applicationaccesses a distributed file system according to an embodiment of thepresent application;

FIG. 4 is a flowchart of an IO bandwidth control method according to anembodiment of the present application;

FIG. 5 is a flowchart of an IO bandwidth control method according to anembodiment of the present application;

FIG. 6 is a flowchart of an IO bandwidth control method according to anembodiment of the present application;

FIG. 7 is a flowchart of an IO bandwidth control method according to anembodiment of the present application;

FIG. 8 is a flowchart of an IO bandwidth control method according to anembodiment of the present application;

FIG. 9 is a flowchart of another IO bandwidth control method accordingto an embodiment of the present application;

FIG. 10 is a flowchart of an IO access request processing methodaccording to an embodiment of the present application;

FIG. 11 is a flowchart of an IO access request processing methodaccording to an embodiment of the present application;

FIG. 12 is a flowchart of an IO access request processing methodaccording to an embodiment of the present application;

FIG. 13 is a schematic structural diagram of a name node according to anembodiment of the present application;

FIG. 14 is a schematic structural diagram of a data node according to anembodiment of the present application;

FIG. 15 is a schematic structural diagram of another data node accordingto an embodiment of the present application;

FIG. 16 is a schematic diagram of hardware of a name node according toan embodiment of the present application;

FIG. 17 is a schematic diagram of hardware of a data node according toan embodiment of the present application; and

FIG. 18 is a schematic diagram of hardware of another data nodeaccording to an embodiment of the present application.

DESCRIPTION OF EMBODIMENTS

The following describes in detail the technical solutions in theembodiments of the present application with reference to theaccompanying drawings in the embodiments of the present application. Thedescribed embodiments are merely some but not all of the embodiments ofthe present application.

In the specification and claims of the present application, the terms“first,” “second,” “third,” and the like are intended to distinguishbetween different objects but do not indicate a particular order of theobjects. For example, a first data node, a second data node, and a thirddata node are intended to distinguish between different data nodes butdo not indicate a particular order of the data nodes.

In the embodiments of the present application, the phrase “for example”is used to represent an example, an example illustration, or anillustration. Any embodiment or design solution that is described as“for example” in the embodiments of the present application should notbe interpreted as better than other embodiments or design solutions.Precisely, the phrase “for example” is used to present a related conceptin a specific manner.

In addition, the terms “include,” “have,” or any other variant thereofmentioned in descriptions of the present application are intended tocover a non-exclusive inclusion. For example, a process, a method, asystem, a product, or a device that includes a series of steps or unitsis not limited to the listed steps or units, but optionally furtherincludes another unlisted step or unit, or optionally further includesanother inherent step or unit of the process, the method, the product,or the device.

A tenant is a logical concept that relates to a resource in adistributed file system. A tenant represents a quantity of resourcesthat can be used in the distributed file system. For example, a tenantrepresents a quantity of IO bandwidths that can be used in thedistributed file system.

A user refers to an account used to log in to a client.

An application refers to an application corresponding to a client towhich a user logs in, for example, a database application correspondingto a database client to which a user logs in, or a web page applicationcorresponding to a web page client to which a user logs in. Theapplication corresponding to the client to which the user logs in mayaccess a distributed file system using a tenant.

A user may log in to at least one client, that is, the user may becorresponding to at least one application. At least one user belongs toa tenant, that is, the at least one user may share an IO bandwidth ofthe tenant, or multiple applications corresponding to at least one userthat belongs to a tenant may share an IO bandwidth of the tenant.

In the embodiments of the present application, an IO bandwidth isallocated from a perspective of a tenant. An IO bandwidth control methodand an IO access request processing method are provided, and the methodsare applied to a distributed file system.

According to one aspect, an embodiment of the present applicationprovides an IO bandwidth control method. The method is applied to adistributed file system, and the distributed file system includes a namenode and at least one data node. In this method, the name nodedetermines an IO bandwidth of each data node in the at least one datanode and an IO bandwidth of a first tenant, and instructs, according tothe IO bandwidth of each data node in the at least one data node and theIO bandwidth of the first tenant, the at least one data node to allocateat least one IO bandwidth to the first tenant. Therefore, in thisembodiment of the present application, an IO bandwidth can be allocatedto a tenant such that a manner of allocating an IO bandwidth isrelatively flexible.

In addition, in other approaches, when each new application accesses adistributed file system, the distributed file system allocates a new IObandwidth to the new application, thereby causing relatively lowutilization of an IO bandwidth in the distributed file system. However,in this embodiment of the present application, after an IO bandwidth isallocated to a tenant, multiple applications corresponding to at leastone user that belongs to the tenant may share the IO bandwidth allocatedto the tenant. Even if the multiple applications may be different atdifferent moments, for example, a new application is added, theseapplications still share the IO bandwidth allocated to the tenant, thatis, allocating another IO bandwidth to the newly added application asthe other approaches does not occur. Therefore, utilization of an IObandwidth in the distributed file system can be improved.

According to another aspect, an embodiment of the present applicationprovides another IO bandwidth control method. The method is applied to adistributed file system, the distributed file system includes at leastone data node, and the at least one data node includes a first datanode. In this method, the first data node determines an IO bandwidth ofeach data node in the at least one data node and an IO bandwidth of afirst tenant, and allocates a first IO bandwidth to the first tenantaccording to the IO bandwidth of each data node in the at least one datanode and the IO bandwidth of the first tenant. Therefore, in thisembodiment of the present application, an IO bandwidth can be allocatedto a tenant such that a manner of allocating an IO bandwidth isrelatively flexible. In this embodiment of the present application, anIO bandwidth can be allocated to a tenant, and multiple applicationscorresponding to at least one user that belongs to the tenant may sharethe IO bandwidth allocated to the tenant. Even if the multipleapplications may be different at different moments, for example, a newapplication is added, these applications still share the IO bandwidthallocated to the tenant, that is, allocating another IO bandwidth to thenewly added application as the other approaches does not occur.Therefore, utilization of an IO bandwidth in the distributed file systemcan be improved.

According to still another aspect, an embodiment of the presentapplication provides an IO access request processing method. Adistributed file system to which the method is applied includes at leastone data node, and the at least one data node includes a first datanode. According to the IO access request processing method provided inthis embodiment of the present application, the first data node receivesan IO access request for accessing the distributed file system by atenant, determines, according to the IO access request, the tenantcorresponding to the IO access request, and then determines, accordingto an IO bandwidth allocated by the first data node to the tenant,whether to delay responding to the IO access request. Therefore, in thisembodiment of the present application, an IO bandwidth can be allocatedto a tenant on a data node, and then the data node may determine,according to the IO bandwidth allocated to the tenant, whether to delayresponding to an IO access request corresponding to the tenant (further,in this application, the IO access request is certainly responded to,and the responding may be immediate responding or delayed responding)such that a success rate of responding to the IO access request can beincreased.

The IO bandwidth control method and the IO access request processingmethod that are provided in the embodiments of the present applicationmay be applied to the distributed file system. As shown in FIG. 2, FIG.2 is a schematic diagram of an architecture of a distributed file systemaccording to an embodiment of the present application. In FIG. 2, thedistributed file system includes a name node and at least one data nodeconnected to the name node.

Optionally, the distributed file system shown in FIG. 2 may furtherinclude an IO recording module (not shown) and a tenant managementmodule (not shown). The IO recording module and the tenant managementmodule may be disposed on the name node and/or the at least one datanode.

With reference to FIG. 2, as shown in FIG. 3, FIG. 3 is a schematicdiagram of an architecture in which an application accesses adistributed file system. In FIG. 3, at least one data node (for example,n data nodes, where n is a positive integer) in the distributed filesystem is respectively a data node 1, . . . , a data node x, . . . , anda data node n. In an actual storage system, a data node allocates an IObandwidth to at least one tenant, and an IO bandwidth of a tenant isallocated to at least one user that belongs to the tenant for use. InFIG. 3, an IO bandwidth of a tenant 2 is allocated to a user 1 and auser 2 that belong to the tenant 2 for use. A user may log in to atleast one client, and both a client 1 and a client 2 in FIG. 3 areclients to which the user 1 logs in. In FIG. 3, each applicationcorresponds to one client. For example, an application 1 corresponds tothe client 1, an application 2 corresponds to the client 2, and anapplication 3 corresponds to a client 3. All the application 1, theapplication 2, and the application 3 can access the distributed filesystem. It should be noted that the application 1, the application 2,and the application 3 may be a same application, or two of theapplication 1, the application 2, and the application 3 are a sameapplication, or all the application 1, the application 2, and theapplication 3 are different applications. Other data nodes in FIG. 3 aresimilar to the data node x. Details are not described herein again.

FIG. 2 is merely an example of the architecture of the distributed filesystem according to an embodiment of the present application, and FIG. 3is merely an example of the architecture in which the applicationaccesses the distributed file system according to an embodiment of thepresent application. Further, specific implementation of the distributedfile system and specific implementation of accessing the distributedfile system by the application may be determined according to an actualuse requirement. This is not limited in the present application.

An embodiment of the present application provides an IO bandwidthcontrol method. The method is applied to a distributed file system, andthe distributed file system may be the distributed file system shown inFIG. 2 or FIG. 3. The distributed file system includes a name node andat least one data node. As shown in FIG. 4, the method includes thefollowing steps.

Step S101: The name node determines an IO bandwidth of each data node inthe at least one data node.

The IO bandwidth of each data node is an IO bandwidth that can beallocated by each data node. Hence, an IO bandwidth of a data noderefers to IO bandwidths that the data node has in total, and the IObandwidth can be allocated by the data node.

Step S102: The name node determines an IO bandwidth of a first tenant.

The IO bandwidth of the first tenant is an IO bandwidth required by thefirst tenant.

For example, when the first tenant requests an IO bandwidth from thename node, the name node may directly set the IO bandwidth of the firsttenant. For example, the name node sets the IO bandwidth of the firsttenant according to an empirical value or according to a value of the IObandwidth requested by the first tenant.

For example, when multiple tenants request IO bandwidths from the namenode, the name node considers both a priority of each tenant and an IObandwidth requested by each tenant, and adjusts the IO bandwidthrequired by each tenant. For example, the name node adjusts the IObandwidth required by the first tenant.

Step S103: The name node instructs, based on the IO bandwidth of eachdata node in the at least one data node and the IO bandwidth of thefirst tenant, the at least one data node to allocate at least one IObandwidth to the first tenant.

The at least one IO bandwidth is in a one-to-one correspondence with theat least one data node, each IO bandwidth in the at least one IObandwidth is less than or equal to an IO bandwidth of a correspondingdata node, and each IO bandwidth in the at least one IO bandwidth isgreater than 0. Further, each of the at least one data node allocates anIO bandwidth to the first tenant according to an instruction of the namenode, and the IO bandwidth allocated by each data node to the firsttenant is greater than 0 and is less than an IO bandwidth of the datanode.

For example, it is assumed that the at least one data node includesthree data nodes, that is, the distributed file system includes threedata nodes, and the three data nodes are respectively a data node 1, adata node 2, and a data node 3. After the name node determines IObandwidths of the three data nodes and the IO bandwidth of the firsttenant, the name node may instruct, based on an IO bandwidth of eachdata node in the three data nodes and the IO bandwidth of the firsttenant, each of the three data nodes to allocate an IO bandwidth to thefirst tenant such that the first tenant obtains three IO bandwidths. Forexample, the name node may instruct, based on the IO bandwidth of eachdata node in the three data nodes and the IO bandwidth of the firsttenant, the data node 1 to allocate an IO bandwidth 1 to the firsttenant, the data node 2 to allocate an IO bandwidth 2 to the firsttenant, and the data node 3 to allocate an IO bandwidth 3 to the firsttenant.

According to the IO bandwidth control method provided in this embodimentof the present application, an IO bandwidth can be allocated to a tenantsuch that a manner of allocating an IO bandwidth is relatively flexible.

The IO bandwidth of the tenant is shared by at least one user, and eachuser in the at least one user corresponds to at least one application.Therefore, multiple applications corresponding to the at least one userthat belongs to the tenant may share the IO bandwidth allocated to thetenant. Even if the multiple applications may be different at differentmoments, the multiple applications still share the IO bandwidthallocated to the tenant such that utilization of an IO bandwidth in thedistributed file system can be improved.

Optionally, in this embodiment of the present application, a sum of theat least one IO bandwidth is less than or equal to the IO bandwidth ofthe first tenant, or a sum of the at least one IO bandwidth is less thanor equal to a sum of the IO bandwidth of the first tenant and an extrabandwidth.

For example, the IO bandwidth required by the first tenant may berelatively large, and the name node may not be capable of allocatingsufficient IO bandwidths to the first tenant. Therefore, the sum of theat least one IO bandwidth is less than or equal to the IO bandwidthrequired by the first tenant, that is, the IO bandwidth of the firsttenant.

For example, because a service priority of the first tenant may berelatively high, the name node needs to preferentially ensure the IObandwidth required by the first tenant. Therefore, the name node mayallocate an extra bandwidth to the first tenant in addition toallocating the IO bandwidth required by the first tenant to the firsttenant in order to preferentially ensure the IO bandwidth required bythe first tenant. Therefore, the sum of the at least one IO bandwidthmay be greater than or equal to the IO bandwidth required by the firsttenant (i.e., the IO bandwidth of the first tenant), and is less than orequal to the sum of the IO bandwidth of the first tenant and the extrabandwidth. The extra bandwidth may be a bandwidth greater than 0.

The name node may instruct a data node to allocate a proper IO bandwidthto the first tenant in order to satisfy an IO bandwidth requirement ofthe first tenant as much as possible.

Optionally, in the IO bandwidth control method provided in thisembodiment of the present application, the at least one data nodeincludes a first data node, an IO bandwidth allocated by the first datanode to the first tenant according to an instruction of the name node isa first IO bandwidth, and the first IO bandwidth is an IO bandwidth thatis in the at least one IO bandwidth and corresponding to the first datanode.

With reference to FIG. 4, as shown in FIG. 5, after step S103, the IObandwidth control method provided in this embodiment of the presentapplication may further include the following steps.

Step S104: The name node determines that an IO bandwidth that is in theat least one IO bandwidth and that is used by the first tenant is atleast one utilized bandwidth.

The at least one utilized bandwidth is in a one-to-one correspondencewith the at least one IO bandwidth.

For each data node in the at least one data node, the data nodeallocates an IO bandwidth to the first tenant according to aninstruction of the name node, and the data node may respond to an IOaccess request of the first tenant using the IO bandwidth. However, fora particular time point, an IO bandwidth (a utilized bandwidth) actuallyused to respond to the IO access request of the first tenant is fixed,and the IO bandwidth may be less than the IO bandwidth allocated by thedata node to the first tenant, or may be equal to the IO bandwidthallocated by the data node to the first tenant. By analogy, at this timepoint, the first tenant has a utilized bandwidth at each data node.

For example, assuming that the at least one data node includes threedata nodes, and the at least one IO bandwidth is an IO bandwidth 1, anIO bandwidth 2, and an IO bandwidth 3, the name node determines that IObandwidths that are in the three IO bandwidths and that are used by thefirst tenant are three utilized bandwidths. For example, an IO bandwidththat is in the IO bandwidth 1 and that is used is a utilized bandwidth1, an IO bandwidth that is in the IO bandwidth 2 and that is used is autilized bandwidth 2, and an IO bandwidth that is in the IO bandwidth 3and that is used is a utilized bandwidth 3. A utilized bandwidth that isin an IO bandwidth and that is used by the first tenant is less than orequal to an IO bandwidth of a data node that allocates the IO bandwidth.

Step S105: The name node instructs the at least one data node to adjusta corresponding IO bandwidth in the at least one IO bandwidth, orinstructs a first data node to adjust a first IO bandwidth, according tothe at least one utilized bandwidth.

After the name node allocates the at least one IO bandwidth to the firsttenant, because the first tenant may not use all the at least one IObandwidth, or the at least one IO bandwidth may be less than the IObandwidth required by the first tenant, the name node needs to instruct,according to the at least one utilized bandwidth that is in the at leastone IO bandwidth and that is used by the first tenant, a correspondingdata node to adjust the IO bandwidth allocated to the first tenant. Inthis way, the name node can properly allocate the IO bandwidth to thefirst tenant.

Optionally, the name node may instruct, according to the at least oneutilized bandwidth that is in the at least one IO bandwidth and that isused by the first tenant, the at least one data node to adjust acorresponding IO bandwidth in the at least one IO bandwidth.Alternatively, the name node may instruct, according to the at least oneutilized bandwidth that is in the at least one IO bandwidth and that isused by the first tenant, the first data node to adjust the first IObandwidth (i.e., the IO bandwidth allocated by the first data node tothe first tenant).

In this embodiment, the at least one data node may include one or morefirst data nodes, and a specific quantity of first data nodes may bedetermined according to an actual use requirement. This is not limitedin the present application. According to the foregoing method, the namenode may instruct, according to the at least one utilized bandwidth thatis in the at least one IO bandwidth and that is used by the firsttenant, at least one data node in the at least one data node to adjustan IO bandwidth allocated by the data node to the first tenant. Forexample, the name node may adjust, by executing at least one of thefollowing (1), (2), or (3), the IO bandwidth allocated to the firsttenant.

(1): Instructing the data node 1 to adjust the IO bandwidth 1 allocatedby the data node 1 to the first tenant.

(2): Instructing the data node 2 to adjust the IO bandwidth 2 allocatedby the data node 2 to the first tenant.

(3): Instructing the data node 3 to adjust the IO bandwidth 3 allocatedby the data node 3 to the first tenant.

According to the foregoing method, after the name node instructs the atleast one data node to allocate the at least one IO bandwidth to thefirst tenant, the name node may instruct, according to the at least oneutilized bandwidth that is in the at least one IO bandwidth and that isused by the first tenant, a corresponding data node to adjust an IObandwidth allocated by the corresponding data node to the first tenant.For example, if the at least one utilized bandwidth that is in the atleast one IO bandwidth and that is used by the first tenant isrelatively large (for example, a difference between the sum of the atleast one IO bandwidth and a sum of the at least one utilized bandwidthis less than or equal to a threshold), the name node instructs thecorresponding data node to increase the IO bandwidth allocated by thecorresponding data node to the first tenant. If the at least oneutilized bandwidth that is in the at least one IO bandwidth and that isused by the first tenant is relatively small (for example, a differencebetween the sum of the at least one IO bandwidth and a sum of the atleast one utilized bandwidth is greater than a threshold), the name nodeinstructs the corresponding data node to decrease the IO bandwidthallocated by the corresponding data node to the first tenant. In thisway, the name node can provide a proper IO bandwidth for the firsttenant, and may satisfy an IO bandwidth requirement of the first tenantas much as possible.

Optionally, with reference to FIG. 4, as shown in FIG. 6, after stepS103, the IO bandwidth control method provided in this embodiment of thepresent application may further include the following steps.

Step S106: The name node determines that an IO bandwidth that is in theat least one IO bandwidth and that is used by the first tenant is atleast one utilized bandwidth.

The at least one utilized bandwidth is in a one-to-one correspondencewith the at least one IO bandwidth.

For specific description of the at least one utilized bandwidth, referto related description of the at least one utilized bandwidth in stepS104. Details are not described herein again.

Step S107: When a difference between a sum of the at least one IObandwidth and a sum of the at least one utilized bandwidth is less thanor equal to a first threshold, the name node instructs a second datanode to allocate an IO bandwidth to the first tenant, where the at leastone data node does not include the second data node.

After the name node instructs the at least one data node to allocate theat least one IO bandwidth to the first tenant, the name node determinesthe at least one utilized bandwidth that is in the at least one IObandwidth and that is used by the first tenant. When the differencebetween the sum of the at least one IO bandwidth and the sum of the atleast one utilized bandwidth is less than or equal to the firstthreshold, it indicates that an IO bandwidth actually used by the firsttenant is very close to the IO bandwidth allocated by the at least onedata node to the first tenant (i.e., the first tenant almost uses allthe IO bandwidth allocated by the at least one data node to the firsttenant). In this case, in order to preferentially ensure a service ofthe first tenant and enable the first tenant to have sufficient IObandwidths, the name node may further instruct another data node (suchas the second data node) other than the at least one data node in thedistributed storage system to allocate an IO bandwidth to the firsttenant, that is, the name node instructs to increase the IO bandwidthallocated to the first tenant.

For example, it is assumed that, in the foregoing three IO bandwidths,the IO bandwidth 1 is 20 megabits per second (Mbit/s), the IO bandwidth2 is 30 Mbit/s, and the IO bandwidth 3 is 50 Mbit/s, and in threeutilized bandwidths in the foregoing three IO bandwidths, a utilizedbandwidth 1 is 20 Mbit/s, a utilized bandwidth 2 is 30 Mbit/s, and autilized bandwidth 3 is 40 Mbit/s. If the first threshold is 20 Mbit/s,a difference between a sum of the three IO bandwidths and a sum of thethree utilized bandwidths is less than the first threshold. Therefore,the name node may instruct the second data node other than the at leastone data node in the distributed storage system to allocate the IObandwidth to the first tenant.

The second data node may be one data node, or may be multiple datanodes. Further, a quantity of second data nodes may be determinedaccording to an actual use requirement. This is not limited in thepresent application.

FIG. 2 is merely described for illustration purposes using an example inwhich the distributed storage system includes at least one data node. Inactual application, the distributed storage system may include more datanodes. This is not limited in the present application.

Optionally, with reference to FIG. 4, as shown in FIG. 7, after stepS103, the IO bandwidth control method provided in this embodiment of thepresent application may further include the following steps.

Step S108: The name node determines that an IO bandwidth that is in theat least one IO bandwidth and that is used by the first tenant is atleast one utilized bandwidth.

The at least one utilized bandwidth is in a one-to-one correspondencewith the at least one IO bandwidth.

For specific description of the at least one utilized bandwidth, referto related description of the at least one utilized bandwidth in stepS104. Details are not described herein again.

Step S109: When a difference between a sum of the at least one IObandwidth and a sum of the at least one utilized bandwidth is greaterthan a first threshold, the name node instructs a third data node toadjust an IO bandwidth allocated by the third data node to the firsttenant to 0, where the at least one data node includes the third datanode.

After the name node instructs the at least one data node to allocate theat least one IO bandwidth to the first tenant, the name node determinesthe at least one utilized bandwidth that is in the at least one IObandwidth and that is used by the first tenant. When the differencebetween the sum of the at least one IO bandwidth and the sum of the atleast one utilized bandwidth is greater than the first threshold, itindicates that an IO bandwidth actually used by the first tenant is farless than the IO bandwidth allocated by the at least one data node tothe first tenant (i.e., the first tenant may use only a part of the IObandwidth allocated by the at least one data node to the first tenant).In this case, in order to save an IO bandwidth (or to provide an IObandwidth that is not used by the first tenant for another tenant foruse), the name node may further instruct the third data node in the atleast one data node to adjust the IO bandwidth allocated by the thirddata node to the first tenant to 0, that is, the name node instructs todecrease the IO bandwidth allocated to the first tenant.

For example, it is assumed that, in the foregoing three IO bandwidths,the IO bandwidth 1 is 20 Mbit/s, the IO bandwidth 2 is 30 Mbit/s, andthe IO bandwidth 3 is 50 Mbit/s, and in three utilized bandwidths in theforegoing three IO bandwidths, a utilized bandwidth 1 is 20 Mbit/s, autilized bandwidth 2 is 20 Mbit/s, and a utilized bandwidth 3 is 0Mbit/s. If the first threshold is 20 Mbit/s, a difference between a sumof the three IO bandwidths and a sum of the three utilized bandwidths isgreater than the first threshold. Therefore, the name node may instructthe third data node (for example, a data node that allocates the IObandwidth 3 to the first tenant) in the at least one data node to adjustthe IO bandwidth allocated by the third data node to the first tenant to0.

The third data node may be one data node, or may be multiple data nodes.Further, a quantity of third data nodes may be determined according toan actual use requirement. This is not limited in the presentapplication.

Optionally, in the IO bandwidth control method provided in thisembodiment of the present application, the at least one data nodeincludes a first data node, an IO bandwidth allocated by the first datanode to the first tenant according to an instruction of the name node isa first IO bandwidth, and the first IO bandwidth is an IO bandwidth thatis in the at least one IO bandwidth and that corresponds to the firstdata node.

With reference to FIG. 4, as shown in FIG. 8, after step S103, themethod may further include the following steps.

Step S110: The name node determines an IO bandwidth that is in a firstIO bandwidth and that is used by the first tenant.

Step S111: The name node instructs, according to the IO bandwidth thatis in the first IO bandwidth and that is used by the first tenant, afirst data node to adjust the first IO bandwidth.

For specific description of the IO bandwidth that is in the first IObandwidth and that is used by the first tenant (an IO bandwidth that isin the first IO bandwidth and that is used by the first tenant), referto related description of the at least one utilized bandwidth in stepS104. Details are not described herein again.

After the name node instructs the at least one data node to allocate theat least one IO bandwidth to the first tenant, the name node maydetermine the IO bandwidth that is in the first IO bandwidth (the IObandwidth allocated by the first data node in the at least one data nodeto the first tenant) and that is used by the first tenant, and then thename node instructs, according to the IO bandwidth that is in the firstIO bandwidth and that is used by the first tenant, the first data nodeto adjust the first IO bandwidth. For example, if the IO bandwidth thatis in the first IO bandwidth and that is used by the first tenant isrelatively large (for example, greater than a threshold), the name nodeinstructs the first data node to increase the first IO bandwidth. If theIO bandwidth that is in the first IO bandwidth and that is used by thefirst tenant is relatively small (for example, less than or equal to athreshold), the name node instructs the first data node to decrease thefirst IO bandwidth. In this way, the name node can provide a proper IObandwidth for the first tenant, and may satisfy an IO bandwidthrequirement of the first tenant as much as possible.

According to the method shown in FIG. 8, the name node may instruct, ina unit of data node, a corresponding data node (for example, the firstdata node) to adjust, within the data node, an IO bandwidth allocated bythe data node to the first tenant. In this way, the name node mayinstruct, according to an IO bandwidth actually used by the first tenanton each data node, a corresponding data node to provide a more proper IObandwidth for the first tenant, and may satisfy an IO bandwidthrequirement of the first tenant as much as possible.

Optionally, in the IO bandwidth control method provided in thisembodiment of the present application, the first tenant is a tenant in mtenants (further, the m tenants include the first tenant), the m tenantsare tenants to which the name node allocates an IO bandwidth, and m is apositive integer. Step S102 may include the following step.

Step S102 a: The name node determines the IO bandwidth of the firsttenant according to a weight of each tenant in m tenants and a sum ofthe IO bandwidth of each data node in the at least one data node.

The weight of each tenant may be determined according to a servicepriority of each tenant and/or an IO bandwidth required by a service ofthe tenant. Further, a higher service priority of a tenant indicates alarger weight of the tenant, and a larger IO bandwidth required by aservice of a tenant indicates a larger weight of the tenant. Optionally,when a weight of a tenant is determined according to a service priorityof the tenant and an IO bandwidth required by a service of the tenant, aweight (such as a weight 1) may be preferentially determined accordingto the service priority of the tenant, then based on the weight, theweight is accordingly adjusted according to the IO bandwidth required bythe service of the tenant, and an adjusted weight (such as a weight 2)is determined as the weight of the tenant. In this way, the determinedweight of the tenant is relatively accurate.

Optionally, the name node may determine the IO bandwidth of the firsttenant using a formula 1.

The formula 1 includes that the IO bandwidth of the first tenant=aweight of the first tenant/a sum of weights of all tenants to which theat least one data node allocates an IO bandwidth×the sum of the IObandwidth of each data node in the at least one data node.

For example, it is assumed that m=3, that is, there are three tenants towhich the at least one data node allocates an IO bandwidth, and thethree tenants are respectively a tenant 1, a tenant 2, and a tenant 3, aweight of the tenant 1 is 1, a weight of the tenant 2 is 2, and a weightof the tenant 3 is 3, and the sum of the IO bandwidths of the data nodesin the at least one data node is M.

An IO bandwidth of the tenant 1=the weight of the tenant 1/(the weightof the tenant 1+the weight of the tenant 2+the weight of the tenant3)×the sum of the IO bandwidth of each data node in the at least onedata node=1/(1+2+3)×M=M/6.

An IO bandwidth of the tenant 2=the weight of the tenant 2/(the weightof the tenant 1+the weight of the tenant 2+the weight of the tenant3)×the sum of the IO bandwidth of each data node in the at least onedata node=2/(1+2+3)×M=M/3.

An IO bandwidth of the tenant 3=the weight of the tenant 3/(the weightof the tenant 1+the weight of the tenant 2+the weight of the tenant3)×the sum of the IO bandwidth of each data node in the at least onedata node=3/(1+2+3)×M=M/2.

When allocating an IO bandwidth to a tenant using the formula 1, becausethe name node performs allocation according to a weight of each tenant,the IO bandwidth allocated to each tenant may evenly satisfy an IObandwidth requirement of each tenant as much as possible.

An embodiment of the present application provides another IO bandwidthcontrol method. The method is applied to a distributed file system, andthe distributed file system may be the distributed file system shown inFIG. 2 or FIG. 3. The distributed file system includes at least one datanode, and the at least one data node includes a first data node. Asshown in FIG. 9, the method includes the following steps.

Step S201: The first data node determines an IO bandwidth of each datanode in the at least one data node.

The IO bandwidth of each data node is an IO bandwidth that can beallocated by each data node. Hence, an IO bandwidth of a data noderefers to IO bandwidths that the data node has in total, and the IObandwidth can be allocated by the data node.

Step S202: The first data node determines an IO bandwidth of a firsttenant.

The IO bandwidth of the first tenant is an IO bandwidth required by thefirst tenant.

For example, when the first tenant requests an IO bandwidth from thefirst data node, the first data node directly sets the IO bandwidth ofthe first tenant. For example, the first data node sets the IO bandwidthof the first tenant according to an empirical value or according to avalue of the IO bandwidth requested by the first tenant.

For example, when multiple tenants request IO bandwidths from the firstdata node, the first data node considers both a priority of each tenantand an IO bandwidth requested by each tenant, and adjusts the IObandwidth required by each tenant. For example, the first data nodeadjusts the IO bandwidth required by the first tenant.

Step S203: The first data node allocates a first IO bandwidth to thefirst tenant according to the IO bandwidth of each data node in the atleast one data node and the IO bandwidth of the first tenant.

The first IO bandwidth is less than or equal to an IO bandwidth of thefirst data node, and the first IO bandwidth is greater than 0. Further,the first data node allocates the first IO bandwidth to the firsttenant. The first IO bandwidth is greater than 0 and is less than the IObandwidth of the first data node.

In this embodiment, the at least one data node may include one or morefirst data nodes, or the first data node may be any one of the at leastone data node.

For example, it is assumed that the at least one data node includesthree data nodes, that is, the distributed file system includes threedata nodes, and the three data nodes are respectively a data node 1, adata node 2, and a data node 3. In an example in which the first datanode is the data node 1, after the data node 1 determines IO bandwidthsof the three data nodes and the IO bandwidth of the first tenant, thedata node 1 may allocate the first IO bandwidth to the first tenantbased on an IO bandwidth of each data node in the three data nodes andthe IO bandwidth of the first tenant. For example, the data node 1 mayallocate an IO bandwidth 1 to the first tenant based on the IO bandwidthof each data node in the three data nodes and the IO bandwidth of thefirst tenant.

According to the IO bandwidth control method provided in this embodimentof the present application, an IO bandwidth can be allocated to a tenantsuch that a manner of allocating an IO bandwidth is relatively flexible.

The IO bandwidth of the tenant is shared by at least one user, and eachuser in the at least one user corresponds to at least one application.Therefore, multiple applications corresponding to the at least one userthat belongs to the tenant may share the IO bandwidth allocated to thetenant. Even if the multiple applications may be different at differentmoments, the multiple applications still share the IO bandwidthallocated to the tenant such that utilization of an IO bandwidth in thedistributed file system can be improved.

In comparison with the IO bandwidth control method shown in FIG. 4, eachdata node may allocate an IO bandwidth to a tenant without aninstruction of a name node in the IO bandwidth control method shown inFIG. 9 in this embodiment. Therefore, the name node does not need toparticipate in an IO bandwidth allocation process, thereby alleviating aburden of the name node, saving resources of the name node, and reducingoverheads of the name node.

Further, because each data node does not need to allocate an IObandwidth to a tenant according to an instruction of the name node, eachdata node may allocate an IO bandwidth to a tenant in real time, therebyimproving real-time quality of controlling an IO bandwidth at a tenantlevel.

Optionally, in this embodiment of the present application, the first IObandwidth is less than or equal to the IO bandwidth of the first tenant,or the first IO bandwidth is less than or equal to a sum of the IObandwidth of the first tenant and an extra bandwidth.

For example, the IO bandwidth required by the first tenant may berelatively large, and the first data node may not be capable ofallocating sufficient IO bandwidths to the first tenant. Therefore, thefirst IO bandwidth is less than or equal to the IO bandwidth required bythe first tenant, that is, the IO bandwidth of the first tenant.

For example, because a service priority of the first tenant may berelatively high, the first data node needs to preferentially ensure theIO bandwidth required by the first tenant. Therefore, the first datanode may allocate an extra bandwidth to the first tenant in addition toallocating the IO bandwidth required by the first tenant to the firsttenant in order to preferentially ensure the IO bandwidth required bythe first tenant. Therefore, the first JO bandwidth may be greater thanor equal to the IO bandwidth required by the first tenant (further, theIO bandwidth of the first tenant), and is less than or equal to the sumof the IO bandwidth of the first tenant and the extra bandwidth. Theextra bandwidth may be a bandwidth greater than 0.

The first data node may allocate a proper IO bandwidth to the firsttenant in order to satisfy an IO bandwidth requirement of the firsttenant as much as possible.

Optionally, with reference to FIG. 9, after step S203, the IO bandwidthcontrol method provided in this embodiment of the present applicationmay further include the following steps.

Step S204: The first data node determines that an IO bandwidth that isused by the first tenant on the at least one data node is at least oneutilized bandwidth.

The at least one utilized bandwidth is in a one-to-one correspondencewith the at least one data node.

For example, it is assumed that the at least one data node includesthree data nodes, and the three data nodes are respectively a data node1, a data node 2, and a data node 3. In an example in which the firstdata node is the data node 1, the first data node obtains, from thethree data nodes (the data node 1, the data node 2, and the data node3), IO bandwidths that are used by the first tenant on the three datanodes, and uses the obtained three IO bandwidths as three utilizedbandwidths. An IO bandwidth used on the data node 1 is a utilizedbandwidth 1, an IO bandwidth used on the data node 2 is a utilizedbandwidth 2, and an IO bandwidth used on the data node 3 is a utilizedbandwidth 3.

A utilized bandwidth used by the first tenant on a data node is lessthan or equal to an IO bandwidth of the data node.

Step S205: The first data node adjusts the first IO bandwidth accordingto the at least one utilized bandwidth.

For example, after the first data node allocates the first IO bandwidthto the first tenant, the first tenant may not use all the first IObandwidth, or the first IO bandwidth may be less than the IO bandwidthrequired by the first tenant, or there is a big difference of using thefirst IO bandwidth by the first tenant (for example, a part of the firstIO bandwidth is entirely used by the first tenant, but the other part ofthe first IO bandwidth is rarely used by the first tenant). Therefore,the first data node needs to adjust, according to an actual utilizedbandwidth (further, the at least one utilized bandwidth) of the firsttenant, the first IO bandwidth allocated by the first data node to thefirst tenant. In this way, the first data node can properly allocate anIO bandwidth to the first tenant.

Optionally, with reference to FIG. 9, after step S203, the IO bandwidthcontrol method provided in this embodiment of the present applicationmay further include the following steps.

Step S206: The first data node determines an IO bandwidth that is in thefirst IO bandwidth and that is used by the first tenant.

Step S207: The first data node adjusts the first IO bandwidth accordingto the IO bandwidth that is in the first IO bandwidth and that is usedby the first tenant.

For specific description of the IO bandwidth that is in the first IObandwidth and that is used by the first tenant (an IO bandwidth that isin the first IO bandwidth and that is used by the first tenant), referto related description of the at least one utilized bandwidth in stepS204. Details are not described herein again.

After the first data node allocates the first IO bandwidth to the firsttenant, the first data node may adjust the first IO bandwidth accordingto an IO bandwidth that is in the first IO bandwidth and that isactually used by the first tenant. For example, if the IO bandwidth thatis in the first IO bandwidth and that is actually used by the firsttenant is relatively large (for example, a difference between the firstIO bandwidth and the IO bandwidth that is in the first IO bandwidth andthat is actually used by the first tenant is less than or equal to athreshold), the first data node increases the first IO bandwidth. If theIO bandwidth that is in the first IO bandwidth and that is actually usedby the first tenant is relatively small (for example, a differencebetween the first IO bandwidth and the IO bandwidth that is in the firstIO bandwidth and that is actually used by the first tenant is greaterthan a threshold), the first data node decreases the first IO bandwidth.In this way, the first data node can provide a proper IO bandwidth forthe first tenant, and may satisfy an IO bandwidth requirement of thefirst tenant as much as possible.

Optionally, in the IO bandwidth control method provided in thisembodiment of the present application, the first tenant is a tenant in mtenants (that is, the m tenants include the first tenant), the m tenantsare tenants to which the at least one data node (including the firstdata node) allocates an IO bandwidth, and m is a positive integer. Withreference to FIG. 9, step S202 may include the following step.

Step S202 a: The first data node determines the IO bandwidth of thefirst tenant according to a weight of each tenant in the m tenants and asum of the IO bandwidth of each data node in the at least one data node.

For specific description of step S202 a, refer to related description ofstep S102 a in the foregoing embodiment. Details are not describedherein again.

When allocating an IO bandwidth to a tenant, because the first data nodeperforms allocation according to a weight of each tenant, the IObandwidth allocated to each tenant may evenly satisfy an IO bandwidthrequirement of each tenant as much as possible.

An embodiment of the present application provides an IO access requestprocessing method. The method is applied to a distributed file system,and the distributed file system may be the distributed file system shownin FIG. 2 or FIG. 3. The distributed file system includes at least onedata node, and the at least one data node includes a first data node. Asshown in FIG. 10, the method includes the following steps.

Step S301: The first data node receives an IO access request, where theIO access request is a request for accessing the distributed file systemby a tenant.

Step S302: The first data node determines, according to the IO accessrequest, the tenant corresponding to the IO access request.

Step S303: The first data node determines, according to an IO bandwidthallocated by the first data node to the tenant, whether to delayresponding to the IO access request.

In this embodiment of the present application, after the first data nodereceives the IO access request for accessing the distributed file systemby the tenant, the first data node first determines, according to the IOaccess request, the tenant corresponding to the IO access request (thatis, a tenant that accesses the distributed file system), and then thefirst data node determines, according to the IO bandwidth allocated bythe first data node to the tenant, whether to delay responding to the IOaccess request. For example, if a large part of the IO bandwidthallocated by the first data node to the tenant has been used by thetenant, that is, the first data node does not have sufficient IObandwidths to respond to the IO access request (an idle IO bandwidth ofthe tenant is less than an IO bandwidth that is required by the tenantto respond to the IO access request), the first data node may delayresponding to the IO access request. If only a small part of the IObandwidth allocated by the first data node to the tenant has been usedby the tenant, that is, the first data node has sufficient IO bandwidthsto respond to the IO access request (an idle IO bandwidth of the tenantis greater than or equal to an IO bandwidth that is required by thetenant to respond to the IO access request), the first data node mayimmediately respond to the IO access request. Specific details aredescribed in the following embodiment, and are not described hereinagain.

The first data node immediately responding to the IO access request maybe understood as the first data node directly responds to the IO accessrequest after the first data node determines that the IO access requestcan be responded to.

The IO access request processing method provided in this embodiment ofthe present application is applied to a distributed file system, thedistributed file system includes at least one data node, and the atleast one data node includes a first data node. In this method, thefirst data node receives an IO access request for accessing thedistributed file system by a tenant, determines, according to the IOaccess request, the tenant corresponding to the IO access request, andthen determines, according to an IO bandwidth allocated by the firstdata node to the tenant, whether to delay responding to the IO accessrequest. In this embodiment of the present application, an IO bandwidthcan be allocated to a tenant on a data node, and then the data node maydetermine, according to the IO bandwidth allocated to the tenant,whether to delay responding to an IO access request corresponding to thetenant (that is, in this embodiment of the present application, the IOaccess request is certainly responded to, and the responding may beimmediate responding or delayed responding) such that a success rate ofresponding to the IO access request can be increased.

Optionally, with reference to FIG. 10, as shown in FIG. 11, step S303may include the following steps.

Step S303 a: The first data node determines a difference between the IObandwidth allocated by the first data node to the tenant and an IObandwidth used by the tenant on the first data node.

The difference may represent the idle IO bandwidth of the tenant.

Step S303 b: The first data node responds to the IO access request whenthe difference is greater than a third threshold.

When the first data node determines that the difference between the IObandwidth allocated by the first data node to the tenant and the IObandwidth used by the tenant on the first data node is greater than thethird threshold, it indicates that some idle IO bandwidths exist in theIO bandwidth allocated by the first data node to the tenant, that is,the first data node has sufficient IO bandwidths to respond to the IOaccess request for accessing the distributed file system by the tenant.In this case, the first data node may immediately respond to the IOaccess request.

Optionally, with reference to FIG. 10, as shown in FIG. 12, step S303may include the following steps.

Step S303 c: The first data node determines a difference between the IObandwidth allocated by the first data node to the tenant and an IObandwidth used by the tenant on the first data node.

Step S303 d: The first data node delays responding to the IO accessrequest when the difference is less than or equal to a third threshold.

When the first data node determines that the difference between the IObandwidth allocated by the first data node to the tenant and the IObandwidth used by the tenant on the first data node is less than orequal to the third threshold, it indicates that few idle IO bandwidthsexist in the IO bandwidth allocated by the first data node to thetenant, that is, the first data node currently does not have sufficientIO bandwidths to respond to the IO access request for accessing thedistributed file system by the tenant. In this case, the first data nodemay delay responding to the IO access request, that is, when IObandwidths remaining in the IO bandwidth allocated by the first datanode to the tenant are sufficient to respond to the IO access request,the first data node responds to the IO access request.

Optionally, in the IO access request processing method provided in thisembodiment of the present application, the first data node may allocatethe IO bandwidth to the tenant using the following method.

Step S304: The first data node receives an instruction of a name node.

Step S305: The first data node allocates the IO bandwidth to the tenantaccording to the instruction of the name node.

The first data node may allocate the IO bandwidth to the tenantaccording to the instruction of the name node. Further, the name nodemay determine a quantity of IO bandwidths that the first data node needsto allocate to the tenant, and then the name node indicates the IObandwidths to the first data node. The first data node allocates, to thetenant, the IO bandwidths indicated by the name node. In this way,because the name node may instruct each data node to allocate an IObandwidth to the tenant, the IO bandwidth can be properly allocated tothe tenant.

Optionally, with reference to FIG. 10, in this embodiment of the presentapplication, step S302 may include the following step.

Step S302 a: The first data node determines, according to a tenantidentifier carried in the IO access request, the tenant corresponding tothe IO access request.

In this embodiment of the present application, the IO access request foraccessing the distributed file system by the tenant may carry the tenantidentifier. Further, the distributed file system manages a file thatbelongs to the tenant, and a file attribute of the file includes thetenant identifier of the tenant. In a scenario, the distributed filesystem manages files of different tenants, and a tenant to which a filebelongs may be determined according to a tenant identifier included in afile attribute of the file.

After receiving the IO access request, the first data node maydetermine, according to the tenant identifier carried in the IO accessrequest, the tenant corresponding to the IO access request.

Optionally, with reference to FIG. 10, in this embodiment of the presentapplication, a file attribute of a file that belongs to the tenant andthat is managed by the distributed file system includes a tenantidentifier, and step S302 may include the following steps.

Step S302 b: The first data node obtains, according to a file specifiedin the IO access request, a file attribute of the file specified in theIO access request.

Step S302 c: The first data node determines, according to a tenantidentifier included in the obtained file attribute, the tenantcorresponding to the IO access request.

In this embodiment of the present application, because the fileattribute of the file that belongs to the tenant and that is managed bythe distributed file system includes the tenant identifier, after thefirst data node receives the IO access request, the first data node mayfirst obtain, according to the file specified in the IO access request,the file attribute of the file specified in the IO access request, andthen the first data node determines, according to the tenant identifierincluded in the file attribute, the tenant corresponding to the IOaccess request.

According to the foregoing two methods, after receiving the IO accessrequest, the first data node may accurately determine the tenantcorresponding to the IO access request, and then determine, according tothe IO bandwidth allocated by the first data node to the tenant, whetherto delay responding to the IO access request.

Optionally, in the distributed file system provided in this embodimentof the present application, an IO bandwidth of a tenant is allocated toat least one user that belongs to the tenant for use, and one user maylog in to at least one client (that is, one user may be corresponding tomultiple applications). After the first data node allocates the IObandwidth to the tenant, the first data node may further allocate an IObandwidth to the at least one user that belongs to the tenant, andallocate an IO bandwidth to the at least one client to which the atleast one user logs in. In this way, the first data node may finallysequentially allocate an IO bandwidth to each client in a form of“tenant→user→client”.

The following describes an example in which the first data nodeallocates the IO bandwidth to the at least one user that belongs to thetenant.

The first data node allocates an IO bandwidth to each user in the atleast one user according to a weight of each user in the at least oneuser and the IO bandwidth allocated by the first data node to thetenant.

The weight of each user may be further determined according to a servicepriority of each user and/or an IO bandwidth required by a service ofthe user. Further, a higher service priority of a user indicates alarger weight of the user, and a larger IO bandwidth required by aservice of a user indicates a larger weight of the user. Optionally,when a weight of a user is determined according to a service priority ofthe user and an IO bandwidth required by a service of the user, a weight(such as a weight 3) may be preferentially determined according to theservice priority of the user, then based on the weight, the weight isaccordingly adjusted according to the IO bandwidth required by theservice of the user, and an adjusted weight (such as a weight 4) isdetermined as the weight of the user. In this way, the determined weightof the user is relatively accurate.

A manner in which the first data node allocates the IO bandwidth to eachuser in the at least one user according to the weight of each user inthe at least one user and the IO bandwidth allocated by the first datanode to the tenant may be as follows.

The first data node allocates, using a formula 2 and based on the IObandwidth allocated by the first data node to the tenant, the IObandwidth to each user in the at least one user that uses the tenant.

The formula 2 includes that an IO bandwidth of a user=a weight of theuser/a sum of weights of all users who use the tenant×the IO bandwidthallocated by the first data node to the tenant.

For example, it is assumed that there are three users using a tenant,and the three users are respectively a user 1, a user 2, and a user 3, aweight of the user 1 is 1, a weight of the user 2 is 2, and a weight ofthe user 3 is 3, and the IO bandwidth allocated by the first data nodeto the tenant is N.

An IO bandwidth of the user 1=the weight of the user 1/(the weight ofthe user 1+the weight of the user 2+the weight of the user 3)×the IObandwidth allocated by the first data node to thetenant=1/(1+2+3)×N=N/6.

An IO bandwidth of the user 2=the weight of the user 2/(the weight ofthe user 1+the weight of the user 2+the weight of the user 3)×the IObandwidth allocated by the first data node to thetenant=2/(1+2+3)×N=N/3.

An IO bandwidth of the user 3=the weight of the user 3/(the weight ofthe user 1+the weight of the user 2+the weight of the user 3)×the IObandwidth allocated by the first data node to thetenant=3/(1+2+3)×N=N/2.

In this embodiment of the present application, when allocating, usingthe formula 2, an IO bandwidth to each user that belongs to the tenant,because the first data node performs allocation according to a weight ofeach user, the IO bandwidth allocated to each user may evenly satisfy anIO bandwidth requirement of each user as much as possible.

The following describes an example in which the first data nodeallocates an IO bandwidth to at least one client to which a first userthat belongs to the tenant logs in. The first user refers to any one ofthe at least one user that belongs to the tenant.

The first data node allocates an IO bandwidth to each client in the atleast one client according to a weight of each client in the at leastone client and an IO bandwidth allocated by the first data node to thefirst user.

The weight of each client may be determined according to a servicepriority of each client and/or an IO bandwidth required by a service ofthe client. Further, a higher service priority of a client indicates alarger weight of the client, and a larger IO bandwidth required by aservice of a client indicates a larger weight of the client. Optionally,when a weight of a client is determined according to a service priorityof the client and an IO bandwidth required by a service of the client, aweight (such as a weight 5) may be preferentially determined accordingto the service priority of the client, then based on the weight, theweight is accordingly adjusted according to the IO bandwidth required bythe service of the client, and an adjusted weight (such as a weight 6)is determined as the weight of the client. In this way, the determinedweight of the client is relatively accurate.

A manner in which the first data node allocates the IO bandwidth to eachclient in the at least one client according to the weight of each clientin the at least one client and the IO bandwidth allocated by the firstdata node to the first user may be as follows.

The first data node allocates, using a formula 3 and based on the IObandwidth allocated by the first data node to the first user, the IObandwidth to each client in the at least one client started by the firstuser.

The formula 3 includes that an IO bandwidth of a client=a weight of theclient/a sum of weights of all clients started by the first user×the IObandwidth allocated by the first data node to the first user.

For example, it is assumed that there are three clients started by thefirst user, and the three clients are respectively a client 1, a client2, and a client 3, a weight of the client 1 is 1, a weight of the client2 is 2, and a weight of the client 3 is 3, and the IO bandwidthallocated by the first data node to the first user is A.

An IO bandwidth of the client 1=the weight of the client 1/(the weightof the client 1+the weight of the client 2+the weight of the client3)×the IO bandwidth allocated by the first data node to the firstuser=1/(1+2+3)×A=A/6.

An IO bandwidth of the client 2=the weight of the client 2/(the weightof the client 1+the weight of the client 2+the weight of the client3)×the IO bandwidth allocated by the first data node to the firstuser=2/(1+2+3)×A=A/3.

An IO bandwidth of the client 3=the weight of the client 3/(the weightof the client 1+the weight of the client 2+the weight of the client3)×the IO bandwidth allocated by the first data node to the firstuser=3/(1+2+3)×A=A/2.

In this embodiment of the present application, when allocating, usingthe formula 3, an IO bandwidth to each client to which a user logs in,because the first data node performs allocation according to a weight ofeach client, the IO bandwidth allocated to each client may evenlysatisfy an IO bandwidth requirement of each client as much as possible.

As shown in FIG. 13, an embodiment of the present application provides aname node. The name node is applied to a distributed file system, thedistributed file system includes the name node and at least one datanode, and the name node is configured to perform steps performed by aname node in the IO bandwidth control method shown in any one of FIG. 4to FIG. 8. The name node may include units and/or modules correspondingto the corresponding steps. For example, the name node includes theunits corresponding to the corresponding steps, and the name nodeincludes a determining unit 10 and an instruction unit 11.

The determining unit 10 is configured to determine an IO bandwidth ofeach data node in the at least one data node and an IO bandwidth of afirst tenant. The instruction unit 11 is configured to instruct, basedon the IO bandwidth of each data node in the at least one data node andthe IO bandwidth of the first tenant that are determined by thedetermining unit 10, the at least one data node to allocate at least oneIO bandwidth to the first tenant. The at least one IO bandwidth is in aone-to-one correspondence with the at least one data node, each IObandwidth in the at least one IO bandwidth is less than or equal to anIO bandwidth of a corresponding data node, and each IO bandwidth in theat least one IO bandwidth is greater than 0.

Optionally, a sum of the at least one IO bandwidth is less than or equalto the IO bandwidth of the first tenant, or a sum of the at least one IObandwidth is less than or equal to a sum of the IO bandwidth of thefirst tenant and an extra bandwidth.

Optionally, the at least one data node includes a first data node, an IObandwidth allocated by the first data node to the first tenant accordingto an instruction of the instruction unit 11 is a first IO bandwidth,and the first IO bandwidth is an IO bandwidth that is in the at leastone IO bandwidth and that corresponds to the first data node.

The determining unit 10 is further configured to determine that an IObandwidth that is in the at least one IO bandwidth and that is used bythe first tenant is at least one utilized bandwidth after theinstruction unit 11 instructs the at least one data node to allocate theat least one IO bandwidth to the first tenant, where the at least oneutilized bandwidth is in a one-to-one correspondence with the at leastone IO bandwidth. The instruction unit 11 is further configured toinstruct the at least one data node to adjust a corresponding IObandwidth in the at least one IO bandwidth, or instruct the first datanode to adjust the first IO bandwidth, according to the at least oneutilized bandwidth determined by the determining unit 10.

Optionally, the determining unit 10 is further configured to determinethat an IO bandwidth that is in the at least one IO bandwidth and thatis used by the first tenant is at least one utilized bandwidth after theinstruction unit 11 instructs the at least one data node to allocate theat least one IO bandwidth to the first tenant, where the at least oneutilized bandwidth is in a one-to-one correspondence with the at leastone IO bandwidth. The instruction unit 11 is further configured toinstruct a second data node to allocate an IO bandwidth to the firsttenant when a difference between the sum of the at least one IObandwidth and a sum of the at least one utilized bandwidth determined bythe determining unit 10 is less than or equal to a first threshold,where the at least one data node does not include the second data node.

Optionally, the determining unit 10 is further configured to determinethat an IO bandwidth that is in the at least one IO bandwidth and thatis used by the first tenant is at least one utilized bandwidth after theinstruction unit 11 instructs the at least one data node to allocate theat least one IO bandwidth to the first tenant, where the at least oneutilized bandwidth is in a one-to-one correspondence with the at leastone IO bandwidth. The instruction unit 11 is further configured toinstruct a third data node to adjust an IO bandwidth allocated by thethird data node to the first tenant to 0 when a difference between thesum of the at least one IO bandwidth and a sum of the at least oneutilized bandwidth determined by the determining unit 10 is greater thana first threshold, where the at least one data node includes the thirddata node.

Optionally, the at least one data node includes a first data node, an IObandwidth allocated by the first data node to the first tenant accordingto an instruction of the instruction unit 11 is a first IO bandwidth,and the first IO bandwidth is an IO bandwidth that is in the at leastone IO bandwidth and corresponding to the first data node.

The determining unit 10 is further configured to determine an IObandwidth that is in the first IO bandwidth and that is used by thefirst tenant after the instruction unit 11 instructs the at least onedata node to allocate the at least one IO bandwidth to the first tenant.The instruction unit 11 is further configured to instruct, according tothe IO bandwidth that is in the first IO bandwidth, that is used by thefirst tenant, and that is determined by the determining unit 10, thefirst data node to adjust the first IO bandwidth.

Optionally, m tenants include the first tenant, and m is a positiveinteger.

The determining unit 10 is further configured to determine the IObandwidth of the first tenant according to a weight of each tenant inthe m tenants and a sum of the IO bandwidth of each data node in the atleast one data node.

The determining unit 10 and the instruction unit 11 may be implementedby at least one processor in the name node by executing a computerexecution instruction stored in a memory.

It can be understood that the name node in this embodiment may becorresponding to a name node in the IO bandwidth control method shown inany one of FIG. 4 to FIG. 8, and division of the units and/or themodules in the name node in this embodiment is to implement the methodprocedure shown in any one of FIG. 4 to FIG. 8. To avoid repetition,implementation of a function of each unit and/or module is not describedherein again.

The name node provided in this embodiment of the present application isapplied to a distributed file system, and the distributed file systemincludes the name node and at least one data node. The name nodedetermines an IO bandwidth of each data node in the at least one datanode and an IO bandwidth of a first tenant, and instructs, according tothe IO bandwidth of each data node in the at least one data node and theIO bandwidth of the first tenant, the at least one data node to allocatethe at least one IO bandwidth to the first tenant. The name nodeprovided in this embodiment of the present application can instruct adata node to allocate an IO bandwidth to a tenant such that a manner ofallocating an IO bandwidth is relatively flexible. Further, the IObandwidth of the tenant is shared by at least one user, and each user inthe at least one user corresponds to at least one application.Therefore, multiple applications that belong to the tenant may share theIO bandwidth allocated to the tenant. Even if the multiple applicationsmay be different at different moments, the multiple applications stillshare the IO bandwidth allocated to the tenant such that utilization ofan IO bandwidth in the distributed file system can be improved.

As shown in FIG. 14, an embodiment of the present application provides adata node. The data node is applied to a distributed file system, thedistributed file system includes at least one data node, and the datanode provided in this embodiment of the present application may be anyone of the at least one data node. The data node is configured toperform steps performed by a first data node in the IO bandwidth controlmethod shown in FIG. 9. The data node may include units and/or modulescorresponding to the corresponding steps. For example, the data nodeincludes the units corresponding to the corresponding steps, and thedata node includes a determining unit 20 and an allocation unit 21.

The determining unit 20 is configured to determine an IO bandwidth ofeach data node in the at least one data node and an IO bandwidth of afirst tenant. The allocation unit 21 is configured to allocate a firstIO bandwidth to the first tenant according to the IO bandwidth of eachdata node in the at least one data node and the IO bandwidth of thefirst tenant that are determined by the determining unit 20. The firstIO bandwidth is less than or equal to an IO bandwidth of a first datanode, and the first IO bandwidth is greater than 0.

Optionally, the determining unit 20 is further configured to determinethat an IO bandwidth that is used by the first tenant on the at leastone data node is at least one utilized bandwidth after the allocationunit 21 allocates the first IO bandwidth to the first tenant. Theallocation unit 21 is further configured to adjust the first IObandwidth according to the at least one utilized bandwidth determined bythe determining unit 20.

Optionally, the determining unit 20 is further configured to determinean IO bandwidth that is in the first IO bandwidth and that is used bythe first tenant after the allocation unit 21 allocates the first IObandwidth to the first tenant. The allocation unit 21 is furtherconfigured to adjust the first IO bandwidth according to the IObandwidth that is in the first IO bandwidth, that is used by the firsttenant, and that is determined by the determining unit 20.

Optionally, the first tenant is a tenant in m tenants (that is, the mtenants include the first tenant), and m is a positive integer.

The determining unit 20 is further configured to determine the IObandwidth of the first tenant according to a weight of each tenant inthe m tenants and a sum of the IO bandwidth of each data node in the atleast one data node.

The determining unit 20 and the allocation unit 21 may be implemented byat least one processor in the data node by executing a computerexecution instruction stored in a memory.

It can be understood that the data node in this embodiment may becorresponding to a first data node in the IO bandwidth control methodshown in FIG. 9, and division of the units and/or the modules in thedata node in this embodiment is to implement the method procedure shownin FIG. 9. To avoid repetition, implementation of a function of eachunit and/or module is not described herein again.

The data node provided in this embodiment of the present application isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesthe data node. The data node determines an IO bandwidth of each datanode in the at least one data node and an IO bandwidth of a firsttenant, and allocates a first IO bandwidth to the first tenant accordingto the IO bandwidth of each data node in the at least one data node andthe IO bandwidth of the first tenant. The data node provided in thisembodiment of the present application can allocate an IO bandwidth to atenant such that a manner of allocating an IO bandwidth is relativelyflexible. Further, the IO bandwidth of the tenant is shared by at leastone user, and each user in the at least one user corresponds to at leastone application. Therefore, multiple applications that belong to thetenant may share the IO bandwidth allocated to the tenant. Even if themultiple applications may be different at different moments, themultiple applications still share the IO bandwidth allocated to thetenant such that utilization of an IO bandwidth in the distributed filesystem can be improved.

As shown in FIG. 15, an embodiment of the present application provides adata node. The data node is applied to a distributed file system, thedistributed file system includes at least one data node, the at leastone data node includes the data node, and the data node is configured toperform steps performed by a data node in the IO access requestprocessing method shown in any one of FIG. 10 to FIG. 12. The data nodemay include units and/or modules corresponding to the correspondingsteps. For example, the data node includes the units corresponding tothe corresponding steps, and the data node includes a receiving unit 30,a determining unit 31, and an allocation unit 32.

The receiving unit 30 is configured to receive an IO access request,where the IO access request is a request for accessing the distributedfile system by a tenant. The determining unit 31 is configured todetermine, according to the IO access request received by the receivingunit 30, the tenant corresponding to the IO access request, anddetermine, according to an IO bandwidth allocated by the allocation unit32 to the tenant, whether to delay responding to the IO access request.

Optionally, the determining unit 31 is further configured to determine adifference between the IO bandwidth allocated by the allocation unit 32to the tenant and an IO bandwidth used by the tenant on the data node,and respond to the IO access request when the difference is greater thana third threshold.

Optionally, the determining unit 31 is further configured to determine adifference between the IO bandwidth allocated by the allocation unit 32to the tenant and an IO bandwidth used by the tenant on the data node,and delay responding to the IO access request when the difference isless than or equal to a third threshold.

Optionally, the receiving unit 30 is further configured to receive aninstruction of a name node before the allocation unit 32 allocates theIO bandwidth to the tenant. The allocation unit 32 is configured toallocate the IO bandwidth to the tenant according to the instruction ofthe name node that is received by the receiving unit 30.

Optionally, the determining unit 31 is further configured to determine,according to a tenant identifier carried in the IO access requestreceived by the receiving unit 30, the tenant corresponding to the IOaccess request.

Optionally, a file attribute of a file that belongs to the tenant andthat is managed by the distributed file system includes a tenantidentifier.

The determining unit 31 is further configured to obtain, according to afile specified in the IO access request received by the receiving unit30, a file attribute of the file specified in the IO access request, anddetermine, according to the tenant identifier included in the obtainedfile attribute, the tenant corresponding to the IO access request.

The receiving unit 30 may be implemented using an interface circuit inthe data node. The determining unit 31 and the allocation unit 32 may beimplemented by at least one processor in the data node by executing acomputer execution instruction stored in a memory.

It can be understood that the data node in this embodiment may becorresponding to a first data node in the IO access request processingmethod shown in any one of FIG. 10 to FIG. 12, and division of the unitsand/or the modules in the data node in this embodiment is to implementthe method procedure shown in any one of FIG. 10 to FIG. 12. To avoidrepetition, implementation of a function of each unit and/or module isnot described herein again.

The data node provided in this embodiment of the present application isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesthe data node. The data node receives an IO access request for accessingthe distributed file system by a tenant, determines, according to the IOaccess request, the tenant corresponding to the IO access request, andthen determines, according to an IO bandwidth allocated by the data nodeto the tenant, whether to delay responding to the IO access request. Inthis embodiment of the present application, an IO bandwidth can beallocated to a tenant on a data node, and then the data node maydetermine, according to the IO bandwidth allocated to the tenant,whether to delay responding to an IO access request corresponding to thetenant (that is, in this application, the IO access request is certainlyresponded to, and the responding may be immediate responding or delayedresponding) such that a success rate of responding to the IO accessrequest can be increased.

As shown in FIG. 16, an embodiment of the present application provides aname node. The name node is applied to a distributed file system, andthe distributed file system includes the name node and at least one datanode. The name node includes at least one processor 40, an interfacecircuit 41, a memory 42, and a system bus 43.

The memory 42 is configured to store a computer execution instruction.The at least one processor 40, the interface circuit 41, and the memory42 are interconnected using the system bus 43. When the name node runs,the at least one processor 40 executes the computer executioninstruction stored in the memory 42 such that the name node performs theIO bandwidth control method shown in any one of FIG. 4 to FIG. 8.Further, for the IO bandwidth control method, refer to relateddescription in the embodiment shown in any one of FIG. 4 to FIG. 8.Details are not described herein again.

The processor 40 may be a central processing unit (CPU). The processor40 may be another general purpose processor, a digital signal processor(DSP), an application-specific integrated circuit (ASIC), a fieldprogrammable gate array (FPGA), another programmable logic device, adiscrete gate, a transistor logic device, a discrete hardware component,or the like. The general purpose processor may be a microprocessor, orthe processor 40 may be any conventional processor or the like.

The processor 40 may be a dedicated processor, and the dedicatedprocessor may include a chip that has another dedicated processingfunction of the name node.

The memory 42 may include a volatile memory, for example, a randomaccess memory (RAM). The memory 42 may include a nonvolatile memory, forexample, a read-only memory (ROM), a flash memory, a hard disk drive(HDD), or a solid-state drive (SSD). The memory 42 may include acombination of the foregoing types of memories.

The system bus 43 may include a data bus, a power bus, a control bus, asignal status bus, and the like. In this embodiment, for clarity ofdescription, various buses are marked as the system bus 43 in FIG. 16.

The interface circuit 41 may be an IO interface, a network interface, ora communications interface on the name node. The at least one processor40 performs data exchange with another device such as a data node usingthe interface circuit 41.

In a specific implementation process, steps in the method procedureshown in any one of FIG. 4 to FIG. 8 may be implemented by thehardware-form processor 40 by executing the software-form computerexecution instruction stored in the memory 42. To avoid repetition,details are not described herein again.

An embodiment of the present application provides a computer readablestorage medium. The computer readable storage medium stores a computerexecution instruction. When at least one processor of a name nodeexecutes the computer execution instruction, the name node performs theIO bandwidth control method shown in any one of FIG. 4 to FIG. 8.Further, for the IO bandwidth control method, refer to relateddescription in the embodiment shown in any one of FIG. 4 to FIG. 8.Details are not described herein again.

An embodiment of the present application provides a computer programproduct. The computer program product includes a computer executioninstruction, and the computer execution instruction is stored in acomputer readable storage medium. At least one processor of a name nodemay read the computer execution instruction from the computer readablestorage medium, and the at least one processor executes the computerexecution instruction such that the name node performs the IO bandwidthcontrol method shown in any one of FIG. 4 to FIG. 8.

The computer readable storage medium may be the memory 42.

The name node provided in this embodiment of the present application isapplied to a distributed file system, and the distributed file systemincludes the name node and at least one data node. The name nodedetermines an IO bandwidth of each data node in the at least one datanode and an IO bandwidth of a first tenant, and instructs, according tothe IO bandwidth of each data node in the at least one data node and theIO bandwidth of the first tenant, the at least one data node to allocateat least one IO bandwidth to the first tenant. The name node provided inthis embodiment of the present application can instruct a data node toallocate an IO bandwidth to a tenant such that a manner of allocating anIO bandwidth is relatively flexible. Further, the IO bandwidth of thetenant is shared by at least one user, and each user in the at least oneuser corresponds to at least one application. Therefore, multipleapplications that belong to the tenant may share the IO bandwidthallocated to the tenant. Even if the multiple applications may bedifferent at different moments, the multiple applications still sharethe IO bandwidth allocated to the tenant such that utilization of an IObandwidth in the distributed file system can be improved.

As shown in FIG. 17, an embodiment of the present application provides adata node. The data node is applied to a distributed file system, thedistributed file system includes at least one data node, and the atleast one data node includes the data node. The data node includes atleast one processor 50, an interface circuit 51, a memory 52, and asystem bus 53.

The memory 52 is configured to store a computer execution instruction.The at least one processor 50, the interface circuit 51, and the memory52 are interconnected using the system bus 53. When the data node runs,the at least one processor 50 executes the computer executioninstruction stored in the memory 52 such that the data node performs theIO bandwidth control method shown in FIG. 9. Further, for the IObandwidth control method, refer to related description in the embodimentshown in FIG. 9. Details are not described herein again.

The processor 50 may be a CPU. The processor 50 may be another generalpurpose processor, a DSP, an ASIC, an FPGA, another programmable logicdevice, a discrete gate, a transistor logic device, a discrete hardwarecomponent, or the like. The general purpose processor may be amicroprocessor, or the processor 50 may be any conventional processor orthe like.

The processor 50 may be a dedicated processor, and the dedicatedprocessor may include a chip that has another dedicated processingfunction of the data node.

The memory 52 may include a volatile memory, such as a RAM. The memory52 may include a nonvolatile memory, such as a ROM, a flash memory, anHDD, or an SSD. The memory 52 may include a combination of the foregoingtypes of memories.

The system bus 53 may include a data bus, a power bus, a control bus, asignal status bus, and the like. In this embodiment, for clarity ofdescription, various buses are marked as the system bus 53 in FIG. 17.

The interface circuit 51 may be an IO interface, a network interface, ora communications interface on the data node. The at least one processor50 performs data exchange with another device such as a name node usingthe interface circuit 51.

In a specific implementation process, steps in the method procedureshown in FIG. 9 may be implemented by the hardware-form processor 50 byexecuting the software-form computer execution instruction stored in thememory 52. To avoid repetition, details are not described herein again.

An embodiment of the present application provides a computer readablestorage medium. The computer readable storage medium stores a computerexecution instruction. When at least one processor of a data nodeexecutes the computer execution instruction, the data node performs theIO bandwidth control method shown in FIG. 9. Further, for the IObandwidth control method, refer to related description in the embodimentshown in FIG. 9. Details are not described herein again.

An embodiment of the present application provides a computer programproduct. The computer program product includes a computer executioninstruction, and the computer execution instruction is stored in acomputer readable storage medium. At least one processor of a data nodemay read the computer execution instruction from the computer readablestorage medium, and the at least one processor executes the computerexecution instruction such that the data node performs the IO bandwidthcontrol method shown in FIG. 9.

The computer readable storage medium may be the memory 52.

The data node provided in this embodiment of the present application isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesthe data node. The data node determines an IO bandwidth of each datanode in the at least one data node and an IO bandwidth of a firsttenant, and allocates a first IO bandwidth to the first tenant accordingto the IO bandwidth of each data node in the at least one data node andthe IO bandwidth of the first tenant. The data node provided in thisembodiment of the present application can allocate an IO bandwidth to atenant such that a manner of allocating an IO bandwidth is relativelyflexible. Further, the IO bandwidth of the tenant is shared by at leastone user, and each user in the at least one user corresponds to at leastone application. Therefore, multiple applications that belong to thetenant may share the IO bandwidth allocated to the tenant. Even if themultiple applications may be different at different moments, themultiple applications still share the IO bandwidth allocated to thetenant such that utilization of an IO bandwidth in the distributed filesystem can be improved.

As shown in FIG. 18, an embodiment of the present application provides adata node. The data node is applied to a distributed file system, thedistributed file system includes at least one data node, and the atleast one data node includes the data node. The data node includes atleast one processor 60, an interface circuit 61, a memory 62, and asystem bus 63.

The memory 62 is configured to store a computer execution instruction.The at least one processor 60, the interface circuit 61, and the memory62 are interconnected using the system bus 63. When the data node runs,the at least one processor 60 executes the computer executioninstruction stored in the memory 62 such that the data node performs theIO access request processing method shown in any one of FIG. 10 to FIG.12. Further, for the IO access request processing method, refer torelated description in the embodiment shown in any one of FIG. 10 toFIG. 12. Details are not described herein again.

The processor 60 may be further a CPU. The processor 60 may be anothergeneral purpose processor, a DSP, an ASIC, an FPGA, another programmablelogic device, a discrete gate, a transistor logic device, a discretehardware component, or the like. The general purpose processor may be amicroprocessor, or the processor 60 may be any conventional processor orthe like.

The processor 60 may be a dedicated processor, and the dedicatedprocessor may include a chip that has another dedicated processingfunction of the data node.

The memory 62 may include a volatile memory, such as a RAM. The memory62 may include a nonvolatile memory, such as a ROM, a flash memory, anHDD, or an SSD. The memory 62 may include a combination of the foregoingtypes of memories.

The system bus 63 may include a data bus, a power bus, a control bus, asignal status bus, and the like. In this embodiment, for clarity ofdescription, various buses are marked as the system bus 63 in FIG. 18.

The interface circuit 61 may be an IO interface, a network interface, ora communications interface on the data node. The at least one processor60 performs data exchange with another device such as a name node usingthe interface circuit 61.

In a specific implementation process, steps in the method procedureshown in any one of FIG. 10 to FIG. 12 may be implemented by thehardware-form processor 60 by executing the software-form computerexecution instruction stored in the memory 62. To avoid repetition,details are not described herein again.

An embodiment of the present application provides a computer readablestorage medium. The computer readable storage medium stores a computerexecution instruction. When at least one processor of a data nodeexecutes the computer execution instruction, the data node performs theIO access request processing method shown in any one of FIG. 10 to FIG.12. Further, for the IO access request processing method, refer torelated description in the embodiment shown in any one of FIG. 10 toFIG. 12. Details are not described herein again.

An embodiment of the present application provides a computer programproduct. The computer program product includes a computer executioninstruction, and the computer execution instruction is stored in acomputer readable storage medium. At least one processor of a data nodemay read the computer execution instruction from the computer readablestorage medium, and the at least one processor executes the computerexecution instruction such that the data node performs the IO accessrequest processing method shown in any one of FIG. 10 to FIG. 12.

The computer readable storage medium may be the memory 62.

The data node provided in this embodiment of the present application isapplied to a distributed file system, the distributed file systemincludes at least one data node, and the at least one data node includesthe data node. The data node receives an IO access request for accessingthe distributed file system by a tenant, determines, according to the IOaccess request, the tenant corresponding to the IO access request, andthen determines, according to an IO bandwidth allocated by the data nodeto the tenant, whether to delay responding to the IO access request. Inthis embodiment of the present application, an IO bandwidth can beallocated to a tenant on a data node, and then the data node maydetermine, according to the IO bandwidth allocated to the tenant,whether to delay responding to an IO access request corresponding to thetenant (that is, in this application, the IO access request is certainlyresponded to, and the responding may be immediate responding or delayedresponding) such that a success rate of responding to the IO accessrequest can be increased.

An embodiment of the present application provides a distributed filesystem. The distributed file system includes a name node and at leastone data node, and the name node is the name node shown in FIG. 13 orFIG. 16.

Alternatively, the distributed file system includes at least one datanode, the at least one data node includes a first data node, and thefirst data node is the data node shown in FIG. 14 or FIG. 17.

Alternatively, the distributed file system includes at least one datanode, the at least one data node includes a first data node, and thefirst data node is the data node shown in FIG. 15 or FIG. 18.

The distributed file system provided in this embodiment of the presentapplication may be the distributed file system shown in FIG. 2 or FIG.3. For details, refer to related description of the distributed filesystem shown in FIG. 2 or FIG. 3 in the foregoing embodiments. Detailsare not described herein again.

The distributed file system provided in this embodiment of the presentapplication includes a name node and at least one data node. The namenode determines an IO bandwidth of each data node in the at least onedata node and an IO bandwidth of a first tenant, and instructs,according to the IO bandwidth of each data node in the at least one datanode and the IO bandwidth of the first tenant, the at least one datanode to allocate the at least one IO bandwidth to the first tenant. Thename node provided in this embodiment of the present application caninstruct a data node to allocate an IO bandwidth to a tenant such that amanner of allocating an IO bandwidth is relatively flexible. Further,the IO bandwidth of the tenant is shared by at least one user, and eachuser in the at least one user corresponds to at least one application.Therefore, multiple applications that belong to the tenant may share theIO bandwidth allocated to the tenant. Even if the multiple applicationsmay be different at different moments, the multiple applications stillshare the IO bandwidth allocated to the tenant such that utilization ofan IO bandwidth in the distributed file system can be improved.

The distributed file system provided in this embodiment of the presentapplication includes at least one data node, and the at least one datanode includes a first data node. The first data node determines an IObandwidth of each data node in the at least one data node and an IObandwidth of a first tenant, and allocates a first IO bandwidth to thefirst tenant according to the IO bandwidth of each data node in the atleast one data node and the IO bandwidth of the first tenant. The datanode provided in this embodiment of the present application can allocatean IO bandwidth to a tenant such that a manner of allocating an IObandwidth is relatively flexible. Further, the IO bandwidth of thetenant is shared by at least one user, and each user in the at least oneuser corresponds to at least one application. Therefore, multipleapplications that belong to the tenant may share the IO bandwidthallocated to the tenant. Even if the multiple applications may bedifferent at different moments, the multiple applications still sharethe IO bandwidth allocated to the tenant such that utilization of an IObandwidth in the distributed file system can be improved.

The distributed file system provided in this embodiment of the presentapplication includes at least one data node, and the at least one datanode includes a first data node. The first data node receives an IOaccess request for accessing the distributed file system by a tenant,determines, according to the IO access request, the tenant correspondingto the IO access request, and then determines, according to an IObandwidth allocated by the first data node to the tenant, whether todelay responding to the IO access request. In this embodiment of thepresent application, an IO bandwidth can be allocated to a tenant on adata node, and then the data node may determine, according to the IObandwidth allocated to the tenant, whether to delay responding to an IOaccess request corresponding to the tenant (that is, in thisapplication, the IO access request is certainly responded to, and theresponding may be immediate responding or delayed responding) such thata success rate of responding to the IO access request can be increased.

The foregoing descriptions about implementation manners allow a personskilled in the art to understand that, for the purpose of convenient andbrief description, division of the foregoing function modules is takenas an example for illustration. In actual application, the foregoingfunctions can be allocated to different modules and implementedaccording to a requirement, that is, an inner structure of an apparatusis divided into different function modules to implement all or a part ofthe functions described above. For a specific working process of theforegoing system, apparatus, and unit, refer to a corresponding processin the foregoing method embodiments. Details are not described hereinagain.

In the several embodiments provided in this application, it should beunderstood that the disclosed system, apparatus, and method may beimplemented in another manner. For example, the described apparatusembodiment is merely an example. For example, the module or unitdivision is merely logical function division and may be other divisionin actual implementation. For example, multiple units or components maybe combined or integrated into another system, or some features may beignored or not performed. In addition, the displayed or discussed mutualcouplings or direct couplings or communication connections may beimplemented using some interfaces, and indirect couplings orcommunication connections between the apparatuses or units may beimplemented in electronic, mechanical, or other forms.

The units described as separate parts may or may not be physicallyseparated, and parts displayed as units may or may not be physicalunits, may be located in one position, or may be distributed on multiplenetwork units. Some or all of the units may be selected according toactual requirements to achieve the objectives of the solutions of theembodiments.

In addition, functional units in the embodiments of the presentapplication may be integrated into one processing unit, or each of theunits may exist alone physically, or two or more units are integratedinto one unit. The integrated unit may be implemented in a form ofhardware, or may be implemented in a form of a software functional unit.

When the integrated unit is implemented in a form of a softwarefunctional unit and sold or used as an independent product, theintegrated unit may be stored in a computer-readable storage medium.Based on such an understanding, the technical solutions of the presentapplication essentially, the part contributing to the other approaches,or all or some of the technical solutions may be implemented in a formof a software product. The software product is stored in a storagemedium and includes several instructions for instructing a computerdevice (which may be a personal computer, a server, a network device, orthe like) or a processor to perform all or some of the steps of themethods described in the embodiments of the present application. Thestorage medium includes any medium that can store program code, such asa flash memory, a removable hard disk, a read-only memory, a randomaccess memory, a magnetic disk, or an optical disc.

The foregoing descriptions are merely specific implementation manners ofthe present application, but are not intended to limit the protectionscope of the present application. Any variation or replacement readilyfigured out by a person skilled in the art within the technical scopedisclosed in the present application shall fall within the protectionscope of the present application. Therefore, the protection scope of thepresent application shall be subject to the protection scope of theclaims.

What is claimed is:
 1. An input output (IO) bandwidth control methodimplemented by a name node in a distributed file system, wherein the IObandwidth control method comprises: determining an IO bandwidth of atleast one data node in the distributed file system; determining an IObandwidth of a first tenant according to a weight of each tenant in aplurality of tenants and a sum of the IO bandwidth of each data node inthe at least one data node, wherein the IO bandwidth of the first tenantis shared by a plurality of users, wherein each user of the plurality ofusers corresponds to a plurality of applications, wherein theapplications corresponding to the users that belong to the first tenantshare the IO bandwidth of the first tenant, and wherein the weight ofeach tenant is based on a service priority of the tenant and an IObandwidth required by a service of the tenant; and instructing, based onthe IO bandwidth of each data node in the at least one data node and theIO bandwidth of the first tenant, the at least one data node to allocateat least one IO bandwidth to the first tenant, wherein the at least oneIO bandwidth is in a one-to-one correspondence with the at least onedata node, wherein each IO bandwidth in the at least one IO bandwidth isless than or equal to an IO bandwidth of a corresponding data node, andwherein each IO bandwidth in the at least one IO bandwidth is greaterthan zero.
 2. The IO bandwidth control method according to claim 1,wherein the at least one data node comprises a first data node, whereinan IO bandwidth allocated by the first data node to the first tenantaccording to an instruction of the name node is a first IO bandwidth,wherein the first IO bandwidth is an IO bandwidth in the at least one IObandwidth corresponding to the first data node, and wherein afterinstructing the at least one data node to allocate the at least one IObandwidth to the first tenant, the IO bandwidth control method furthercomprises: determining that an IO bandwidth that is in the at least oneIO bandwidth and that is used by the first tenant is at least oneutilized bandwidth, wherein the at least one utilized bandwidth is in aone-to-one correspondence with the at least one IO bandwidth; and eitherinstructing the at least one data node to adjust a corresponding IObandwidth in the at least one IO bandwidth, or instructing the firstdata node to adjust the first IO bandwidth according to the at least oneutilized bandwidth.
 3. The IO bandwidth control method according toclaim 1, wherein after instructing the at least one data node toallocate the at least one IO bandwidth to the first tenant, the IObandwidth control method further comprises: determining that an IObandwidth that is in the at least one IO bandwidth and that is used bythe first tenant is at least one utilized bandwidth, wherein the atleast one utilized bandwidth is in a one-to-one correspondence with theat least one IO bandwidth; and instructing a second data node toallocate an IO bandwidth to the first tenant when a difference between asum of the at least one IO bandwidth and a sum of the at least oneutilized bandwidth is less than or equal to a first threshold, whereinthe at least one data node does not comprise the second data node. 4.The IO bandwidth control method according to claim 1, wherein afterinstructing the at least one data node to allocate the at least one IObandwidth to the first tenant, the IO bandwidth control method furthercomprises: determining that an IO bandwidth that is in the at least oneIO bandwidth and that is used by the first tenant is at least oneutilized bandwidth, wherein the at least one utilized bandwidth is in aone-to-one correspondence with the at least one IO bandwidth; andinstructing a third data node to adjust an IO bandwidth allocated by thethird data node to the first tenant to zero when a difference between asum of the at least one IO bandwidth and a sum of the at least oneutilized bandwidth is greater than a first threshold, wherein the atleast one data node comprises the third data node.
 5. The IO bandwidthcontrol method according to claim 1, wherein the at least one data nodecomprises a first data node, wherein an IO bandwidth allocated by thefirst data node to the first tenant according to an instruction of thename node is a first IO bandwidth, wherein the first IO bandwidth is anIO bandwidth in the at least one IO bandwidth corresponding to the firstdata node, and wherein after instructing the at least one data node toallocate the at least one IO bandwidth to the first tenant, the IObandwidth control method further comprises: determining an IO bandwidththat is in the first IO bandwidth and that is used by the first tenant;and instructing, according to the IO bandwidth that is in the first IObandwidth and that is used by the first tenant, the first data node toadjust the first IO bandwidth.
 6. A name node in a distributed filesystem, wherein the name node comprises: a processor; and a memorycoupled to the processor and configured to store instructions, whereinthe instructions cause the processor to be configured to: determine aninput output (IO) bandwidth of at least one data node in the distributedfile system; determine an IO bandwidth of a first tenant according to aweight of each tenant in a plurality of tenants and a sum of the IObandwidth of each data node in the at least one data node, wherein theIO bandwidth of the first tenant is shared by a plurality of users,wherein each user of the plurality of users corresponds to a pluralityof applications, wherein the applications corresponding to the usersthat belong to the first tenant share the IO bandwidth of the firsttenant, wherein the weight of each tenant is based on a service priorityof the tenant and an IO bandwidth required by a service of the tenant;and instruct, based on the IO bandwidth of each data node in the atleast one data node and the IO bandwidth of the first tenant, the atleast one data node to allocate at least one IO bandwidth to the firsttenant, wherein the at least one IO bandwidth is in a one-to-onecorrespondence with the at least one data node, wherein each IObandwidth in the at least one IO bandwidth is less than or equal to anIO bandwidth of a corresponding data node, and wherein each IO bandwidthin the at least one IO bandwidth is greater than
 0. 7. The name nodeaccording to claim 6, wherein the at least one data node comprises afirst data node, wherein an IO bandwidth allocated by the first datanode to the first tenant according to an instruction of the name node isa first IO bandwidth, wherein the first IO bandwidth is an IO bandwidthin the at least one IO bandwidth corresponding to the first data node,and wherein the instructions further cause the processor to beconfigured to: determine that an IO bandwidth that is in the at leastone IO bandwidth and that is used by the first tenant is at least oneutilized bandwidth after instructing the at least one data node toallocate the at least one IO bandwidth to the first tenant, wherein theat least one utilized bandwidth is in a one-to-one correspondence withthe at least one IO bandwidth; and either instruct the at least one datanode to adjust a corresponding IO bandwidth in the at least one IObandwidth, or instruct the first data node to adjust the first IObandwidth according to the at least one utilized bandwidth.
 8. The namenode according to claim 6, wherein the instructions further cause theprocessor to be configured to: determine that an IO bandwidth that is inthe at least one IO bandwidth and that is used by the first tenant is atleast one utilized bandwidth after instructing the at least one datanode to allocate the at least one IO bandwidth to the first tenant,wherein the at least one utilized bandwidth is in a one-to-onecorrespondence with the at least one IO bandwidth; and instruct a seconddata node to allocate an IO bandwidth to the first tenant when adifference between a sum of the at least one IO bandwidth and a sum ofthe at least one utilized bandwidth is less than or equal to a firstthreshold, wherein the at least one data node does not comprise thesecond data node.
 9. The name node according to claim 6, wherein theinstructions further cause the processor to be configured to: determinethat an IO bandwidth that is in the at least one IO bandwidth and thatis used by the first tenant is at least one utilized bandwidth afterinstructing the at least one data node to allocate the at least one IObandwidth to the first tenant, wherein the at least one utilizedbandwidth is in a one-to-one correspondence with the at least one IObandwidth; and instruct a third data node to adjust an IO bandwidthallocated by the third data node to the first tenant to 0 when adifference between a sum of the at least one IO bandwidth and a sum ofthe at least one utilized bandwidth is greater than a first threshold,wherein the at least one data node comprises the third data node. 10.The name node according to claim 6, wherein the at least one data nodecomprises a first data node, wherein an IO bandwidth allocated by thefirst data node to the first tenant according to an instruction of thename node is a first IO bandwidth, wherein the first IO bandwidth is anIO bandwidth in the at least one IO bandwidth corresponding to the firstdata node, and wherein the instructions further cause the processor tobe configured to: determine an IO bandwidth that is in the first IObandwidth and that is used by the first tenant after instructing the atleast one data node to allocate the at least one IO bandwidth to thefirst tenant; and instruct, according to the IO bandwidth that is in thefirst IO bandwidth and that is used by the first tenant, the first datanode to adjust the first IO bandwidth.